From 86a6df80b0e40855097fcf836cf11bd4808882f6 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 23 Sep 2013 17:35:54 +0300 Subject: Added support for multiple error messages --- tests/fixtures/multierror.xml | 22 ++++++++++++++++++++++ tests/test_gsxws.py | 19 +++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/multierror.xml (limited to 'tests') diff --git a/tests/fixtures/multierror.xml b/tests/fixtures/multierror.xml new file mode 100644 index 0000000..bedb975 --- /dev/null +++ b/tests/fixtures/multierror.xml @@ -0,0 +1,22 @@ + + + + + GSX.SYS.003 + Multiple error messages exist. Please check the detail section. + + iZETtEmzsD82QJs0P1hBgfJ + + + RPR.ONS.025 + This unit is not eligible for an Onsite repair from GSX. + + + RPR.ONS.026 + At least one part should be eligible for Onsite. + + + + + + diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 6146a2c..59c0662 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -8,14 +8,29 @@ from unittest import main, skip, TestCase from gsxws.objectify import parse from gsxws.products import Product -from gsxws import repairs, escalations +from gsxws import repairs, escalations, GsxError class RemoteTestCase(TestCase): def setUp(self): from gsxws.core import connect logging.basicConfig(level=logging.DEBUG) - connect(env['GSX_USER'], env['GSX_PASSWORD'], env['GSX_SOLDTO'], env['GSX_ENV']) + connect(env['GSX_USER'], + env['GSX_PASSWORD'], + env['GSX_SOLDTO'], + env['GSX_ENV']) + + +class TestErrorFunctions(TestCase): + def setUp(self): + xml = open('tests/fixtures/multierror.xml', 'r').read() + self.data = GsxError(xml=xml) + + def test_code(self): + self.assertEqual(self.data.errors['RPR.ONS.025'], + 'This unit is not eligible for an Onsite repair from GSX.') + def test_message(self): + self.assertRegexpMatches(self.data.message, 'Multiple error messages exist.') class TestEscalationFunctions(RemoteTestCase): -- cgit v1.2.3