#!/usr/bin/env python import xml.sax import unittest import boto.handler import boto.resultset import boto.cloudformation SAMPLE_XML = r""" value0 key0 key1 value1 arn:aws:cloudformation:ap-southeast-1:100:stack/Name/id CREATE_COMPLETE Name arn:aws:sns:ap-southeast-1:100:name 2013-01-10T05:04:56Z false value0 output0 key0 value1 output1 key1 1 """ class TestStackParse(unittest.TestCase): def test_parse_tags(self): rs = boto.resultset.ResultSet([('member', boto.cloudformation.stack.Stack)]) h = boto.handler.XmlHandler(rs, None) xml.sax.parseString(SAMPLE_XML, h) tags = rs[0].tags self.assertEqual(tags, {u'key0': u'value0', u'key1': u'value1'}) if __name__ == '__main__': unittest.main()