From c89e5b824c794c209a049647ed4a25e5a7a7b12a Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Mon, 7 Jan 2019 15:45:15 -0500 Subject: [PATCH] Add hook into CSP when deleting an environment role --- atst/domain/csp/cloud.py | 11 +++++++++++ atst/domain/environment_roles.py | 1 + 2 files changed, 12 insertions(+) diff --git a/atst/domain/csp/cloud.py b/atst/domain/csp/cloud.py index 0fd7d3c0..973d6283 100644 --- a/atst/domain/csp/cloud.py +++ b/atst/domain/csp/cloud.py @@ -18,6 +18,13 @@ class CloudProviderInterface: """ raise NotImplementedError() + def delete_role(self, environment_role): # pragma: no cover + """Takes an `atst.model.EnvironmentRole` object and performs any action + necessary in the CSP to remove the specified user from the specified + environment. This method does not return anything. + """ + raise NotImplementedError() + class MockCloudProvider(CloudProviderInterface): def create_application(self, name): @@ -28,3 +35,7 @@ class MockCloudProvider(CloudProviderInterface): def create_role(self, environment_role): # Currently, there is nothing to mock out, so just do nothing. pass + + def delete_role(self, environment_role): + # Currently nothing to do. + pass diff --git a/atst/domain/environment_roles.py b/atst/domain/environment_roles.py index 8c38ec21..012ceabd 100644 --- a/atst/domain/environment_roles.py +++ b/atst/domain/environment_roles.py @@ -27,6 +27,7 @@ class EnvironmentRoles(object): def delete(cls, user_id, environment_id): existing_env_role = EnvironmentRoles.get(user_id, environment_id) if existing_env_role: + app.csp.cloud.delete_role(existing_env_role) db.session.delete(existing_env_role) db.session.commit() return True