diff options
-rw-r--r-- | gsxws/core.py | 6 | ||||
-rw-r--r-- | tests/test_gsxws.py | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gsxws/core.py b/gsxws/core.py index eaf241d..b3c0d8b 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -392,6 +392,12 @@ class GsxObject(object): return root + def __unicode__(self): + return ET.tostring(self.to_xml('root'), encoding='UTF-8') + + def __str__(self): + return unicode(self).encode('utf-8') + class GsxRequestObject(GsxObject): "The GSX-friendly representation of this GsxObject" diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 432ed64..bee83b0 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -20,6 +20,12 @@ class RemoteTestCase(TestCase): env['GSX_ENV']) +class TestCoreFunctions(TestCase): + def test_dump(self): + r = repairs.Repair(blaa='test') + self.assertRegexpMatches(str(r), '<root><blaa>test</blaa></root>') + + class TestErrorFunctions(TestCase): def setUp(self): xml = open('tests/fixtures/multierror.xml', 'r').read() |