OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 import xml.sax |
| 3 import unittest |
| 4 import boto.handler |
| 5 import boto.resultset |
| 6 import boto.cloudformation |
| 7 |
| 8 SAMPLE_XML = r""" |
| 9 <DescribeStacksResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-1
5/"> |
| 10 <DescribeStacksResult> |
| 11 <Stacks> |
| 12 <member> |
| 13 <Tags> |
| 14 <member> |
| 15 <Value>value0</Value> |
| 16 <Key>key0</Key> |
| 17 </member> |
| 18 <member> |
| 19 <Key>key1</Key> |
| 20 <Value>value1</Value> |
| 21 </member> |
| 22 </Tags> |
| 23 <StackId>arn:aws:cloudformation:ap-southeast-1:100:stack/Name/id</StackI
d> |
| 24 <StackStatus>CREATE_COMPLETE</StackStatus> |
| 25 <StackName>Name</StackName> |
| 26 <StackStatusReason/> |
| 27 <Description/> |
| 28 <NotificationARNs> |
| 29 <member>arn:aws:sns:ap-southeast-1:100:name</member> |
| 30 </NotificationARNs> |
| 31 <CreationTime>2013-01-10T05:04:56Z</CreationTime> |
| 32 <DisableRollback>false</DisableRollback> |
| 33 <Outputs> |
| 34 <member> |
| 35 <OutputValue>value0</OutputValue> |
| 36 <Description>output0</Description> |
| 37 <OutputKey>key0</OutputKey> |
| 38 </member> |
| 39 <member> |
| 40 <OutputValue>value1</OutputValue> |
| 41 <Description>output1</Description> |
| 42 <OutputKey>key1</OutputKey> |
| 43 </member> |
| 44 </Outputs> |
| 45 </member> |
| 46 </Stacks> |
| 47 </DescribeStacksResult> |
| 48 <ResponseMetadata> |
| 49 <RequestId>1</RequestId> |
| 50 </ResponseMetadata> |
| 51 </DescribeStacksResponse> |
| 52 """ |
| 53 |
| 54 class TestStackParse(unittest.TestCase): |
| 55 def test_parse_tags(self): |
| 56 rs = boto.resultset.ResultSet([('member', boto.cloudformation.stack.Stac
k)]) |
| 57 h = boto.handler.XmlHandler(rs, None) |
| 58 xml.sax.parseString(SAMPLE_XML, h) |
| 59 tags = rs[0].tags |
| 60 self.assertEqual(tags, {u'key0': u'value0', u'key1': u'value1'}) |
| 61 |
| 62 if __name__ == '__main__': |
| 63 unittest.main() |
OLD | NEW |