def test_diff_parameters_overrides_defaults(caplog, loader, client): key = uuid() before = uuid() after = uuid() key2 = uuid() template = { 'Resources': '1234', 'Parameters': { key: { 'Default': after }, key2: { 'Default': after } } } loader_return(loader, template) client.get_template.return_value = {'TemplateBody': json.dumps(template)} client.describe_stacks.return_value = { 'Stacks': [{ 'Parameters': [{ 'ParameterKey': key, 'ParameterValue': before }, { 'ParameterKey': key2, 'ParameterValue': before }] }] } compare_stack(STACK, parameters={key2: before}) check_echo(caplog, [key, before, after, 'Values Changed']) check_no_echo(caplog, [key2])
def test_request_returns_string(loader, client, caplog): loader_return(loader, {'Resources': u'1234'}) client.get_template.return_value = { 'TemplateBody': yaml.dump({'Resources': '1234'}) } compare_stack(STACK) check_no_echo(caplog, ['1234'])
def test_long_numbers(loader, client, caplog): id1 = '987497529474523452345234' id2 = '235462563563456345634563' loader_return(loader, {'Resources': id1}) client.get_template.return_value = { 'TemplateBody': yaml.dump({'Resources': id2}) } compare_stack(STACK) check_echo(caplog, [id1, id2])
def test_diff_tags(caplog, loader, client): key = uuid() before = uuid() after = uuid() loader_return(loader, {'Resources': u'1234'}) client.get_template.return_value = { 'TemplateBody': yaml.dump({'Resources': '1234'}) } client.describe_stacks.return_value = { 'Stacks': [{ 'Tags': [{ 'Key': key, 'Value': before }] }] } compare_stack(STACK, tags={key: after}) check_echo(caplog, [key, before, after, 'Values Changed'])
def test_type_changed(loader, client, caplog): loader_return(loader, {'Resources': 5}) template_return(client, {'Resources': 'abcde'}) compare_stack(STACK) check_echo(caplog, ['Resources', 'abcde', '5', 'Type Changes'])
def test_dictionary_item_removed(loader, client, caplog): loader_return(loader, {}) template_return(client, {'Resources': '5678'}) compare_stack(STACK) check_echo(caplog, ['Resources', '5678', 'not present', 'Dictionary Item Removed'])
def test_values_changed(loader, client, caplog): loader_return(loader, {'Resources': '5678'}) template_return(client, {'Resources': '1234'}) compare_stack(STACK) check_echo(caplog, ['Resources', '1234', '5678', 'Values Changed'])
def test_unicode_string_no_diff(loader, client, caplog): loader_return(loader, {'Resources': u'1234'}) template_return(client, {'Resources': '1234'}) compare_stack(STACK) check_no_echo(caplog, ['1234'])
def test_loads_stack_data(client, loader, mocker): compare_stack(STACK) client.get_template.assert_called_with(StackName=STACK) client.describe_stacks.assert_called_with(StackName=STACK)
def test_yaml_tags(loader, client, caplog): tagged_template = 'Resources: !Not []' loader_return(loader, {'Resources': {"Not": []}}) client.get_template.return_value = {'TemplateBody': tagged_template} compare_stack(STACK)
def test_iterable_item_removed(loader, client, caplog): loader_return(loader, {'Resources': [1]}) template_return(client, {'Resources': [1, 2]}) compare_stack(STACK) check_echo(caplog, ['Resources > 1', '2', 'not present', 'Iterable Item Removed'])