Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serialization of ChangeTagsForResource #328

Merged
merged 1 commit into from
Jul 31, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion botocore/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def to_xml(self, value, label=None):
return inner_xml
else:
if not label:
label = self.xmlname
label = self.xmlname or self.name
return '<%s>' % label + inner_xml + '</%s>' % label


Expand Down
18 changes: 14 additions & 4 deletions tests/unit/test_route53_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
CREATE_RRSET_PAYLOAD="""<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><ChangeBatch><Comment>Adding TXT record</Comment><Changes><Change><Action>CREATE</Action><ResourceRecordSet><Name>midocs.com</Name><Type>TXT</Type><TTL>600</TTL><ResourceRecords><ResourceRecord><Value>"v=foobar"</Value></ResourceRecord></ResourceRecords></ResourceRecordSet></Change></Changes></ChangeBatch></ChangeResourceRecordSetsRequest>"""
DELETE_RRSET_PAYLOAD="""<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><ChangeBatch><Comment>Adding TXT record</Comment><Changes><Change><Action>DELETE</Action><ResourceRecordSet><Name>midocs.com</Name><Type>TXT</Type><TTL>600</TTL><ResourceRecords><ResourceRecord><Value>"v=foobar"</Value></ResourceRecord></ResourceRecords></ResourceRecordSet></Change></Changes></ChangeBatch></ChangeResourceRecordSetsRequest>"""
CREATE_HEALTH_CHECK_PAYLOAD="""<CreateHealthCheckRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><CallerReference>foobar</CallerReference><HealthCheckConfig><IPAddress>192.168.10.0</IPAddress><Port>8888</Port><Type>HTTP</Type><ResourcePath>foo/bar</ResourcePath><FullyQualifiedDomainName>foobar.com</FullyQualifiedDomainName></HealthCheckConfig></CreateHealthCheckRequest>"""
CHANGE_TAGS_FOR_RESOURCE_PAYLOAD = """<ChangeTagsForResourceRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><AddTags><Tag><Key>keyname</Key><Value>valuename</Value></Tag></AddTags></ChangeTagsForResourceRequest>"""


class TestRoute53Operations(BaseSessionTest):

maxDiff = None

def setUp(self):
super(TestRoute53Operations, self).setUp()
self.environ['AWS_ACCESS_KEY_ID'] = 'foo'
Expand All @@ -38,7 +41,6 @@ def test_create_hosted_zone(self):
params = op.build_parameters(name=self.hosted_zone_name,
caller_reference='foobar',
hosted_zone_config=hzc)
self.maxDiff = None
self.assertEqual(params['payload'].getvalue(),
CREATE_HOSTED_ZONE_PAYLOAD)

Expand All @@ -54,7 +56,6 @@ def test_create_resource_record_sets(self):
{"Value":"\"v=foobar\""}]}}]}
params = op.build_parameters(hosted_zone_id='1111',
change_batch=batch)
self.maxDiff = None
self.assertEqual(params['payload'].getvalue(),
CREATE_RRSET_PAYLOAD)

Expand All @@ -70,7 +71,6 @@ def test_delete_resource_record_sets(self):
{"Value":"\"v=foobar\""}]}}]}
params = op.build_parameters(hosted_zone_id='1111',
change_batch=batch)
self.maxDiff = None
self.assertEqual(params['payload'].getvalue(),
DELETE_RRSET_PAYLOAD)

Expand All @@ -83,6 +83,16 @@ def test_create_healthcheck(self):
'FullyQualifiedDomainName': 'foobar.com'}
params = op.build_parameters(caller_reference='foobar',
health_check_config=hc_config)
self.maxDiff = None
self.assertEqual(params['payload'].getvalue(),
CREATE_HEALTH_CHECK_PAYLOAD)

def test_change_tags_for_resource(self):
op = self.route53.get_operation('ChangeTagsForResource')
arguments = {
'ResourceType': 'healthcheck',
'ResourceId': 'foo',
'AddTags': [{'Key': 'keyname', 'Value': 'valuename'}]
}
params = op.build_parameters(**arguments)
self.assertEqual(params['payload'].getvalue(),
CHANGE_TAGS_FOR_RESOURCE_PAYLOAD)