Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-harvey-z3q committed Jun 1, 2024
1 parent c46c5d6 commit 2803bfe
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ def test_create_change_set_sends_correct_request(self):
"CAPABILITY_AUTO_EXPAND",
],
"ChangeSetName": sentinel.change_set_name,
"ChangeSetType": "UPDATE",
"RoleARN": sentinel.cloudformation_service_role,
"NotificationARNs": [sentinel.notification],
"Tags": [{"Key": "tag1", "Value": "val1"}],
Expand Down Expand Up @@ -658,12 +659,40 @@ def test_create_change_set_sends_correct_request_no_notifications(self):
"CAPABILITY_AUTO_EXPAND",
],
"ChangeSetName": sentinel.change_set_name,
"ChangeSetType": "UPDATE",
"RoleARN": sentinel.cloudformation_service_role,
"NotificationARNs": [],
"Tags": [{"Key": "tag1", "Value": "val1"}],
},
)

@patch("sceptre.plan.actions.StackActions._get_status")
def test_create_change_set_with_non_existent_stack(
self, mock_get_status
):
mock_get_status.side_effect = StackDoesNotExistError()
self.template._body = sentinel.template
self.actions.create_change_set(sentinel.change_set_name)
self.actions.connection_manager.call.assert_called_with(
service="cloudformation",
command="create_change_set",
kwargs={
"StackName": sentinel.external_name,
"TemplateBody": sentinel.template,
"Parameters": [{"ParameterKey": "key1", "ParameterValue": "val1"}],
"Capabilities": [
"CAPABILITY_IAM",
"CAPABILITY_NAMED_IAM",
"CAPABILITY_AUTO_EXPAND",
],
"ChangeSetName": sentinel.change_set_name,
"ChangeSetType": "CREATE",
"RoleARN": sentinel.cloudformation_service_role,
"NotificationARNs": [sentinel.notification],
"Tags": [{"Key": "tag1", "Value": "val1"}],
},
)

def test_delete_change_set_sends_correct_request(self):
self.actions.delete_change_set(sentinel.change_set_name)
self.actions.connection_manager.call.assert_called_with(
Expand Down

0 comments on commit 2803bfe

Please sign in to comment.