diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-08-25 23:07:56 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-08-25 23:07:56 +0300 |
commit | b37b548ff21dc78eb8fff2a736f4acddeff0bda3 (patch) | |
tree | 5d9c4a72f8e8937cc22881ca0cd9371899eb91bb /tests | |
parent | b016ac1f696655344ecd68020b7c97c7ff18907c (diff) | |
download | py-gsxws-b37b548ff21dc78eb8fff2a736f4acddeff0bda3.tar.gz py-gsxws-b37b548ff21dc78eb8fff2a736f4acddeff0bda3.tar.bz2 py-gsxws-b37b548ff21dc78eb8fff2a736f4acddeff0bda3.zip |
Cleanup
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fixtures/error_ca_fmip.xml | 14 | ||||
-rw-r--r-- | tests/test_gsxws.py | 19 |
2 files changed, 31 insertions, 2 deletions
diff --git a/tests/fixtures/error_ca_fmip.xml b/tests/fixtures/error_ca_fmip.xml new file mode 100644 index 0000000..84f7805 --- /dev/null +++ b/tests/fixtures/error_ca_fmip.xml @@ -0,0 +1,14 @@ +<?xml version='1.0' encoding='UTF-8'?> +<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> + <S:Body> + <ns6:CreateCarryInResponse xmlns:ns2="http://asp.core.endpoint.ws.gsx.ist.apple.com/" xmlns:ns3="http://gsxws.apple.com/elements/core/asp" xmlns:ns4="http://gsxws.apple.com/elements/global" xmlns:ns5="http://gsxws.apple.com/elements/core" xmlns:ns6="http://gsxws.apple.com/elements/core/asp/emea"> + <CreateCarryInResponse> + <operationId>n6SnRBjUSJWdf6YQBZ3WhLN</operationId> + <repairConfirmation> + <outCome>STOP</outCome> + <messages>A repair cannot be created for this product because Find My iPhone is active. Please have the customer turn off Find My iPhone before proceeding</messages> + </repairConfirmation> + </CreateCarryInResponse> + </ns6:CreateCarryInResponse> + </S:Body> +</S:Envelope> diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 07a7ca4..8690524 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -155,6 +155,14 @@ class TestErrorFunctions(TestCase): e = GsxError(msg) self.assertEqual(e.message, msg) + def test_error_ca_fmip(self): + from gsxws.core import GsxResponse + xml = open('tests/fixtures/error_ca_fmip.xml', 'r').read() + with self.assertRaisesRegexp(GsxError, 'A repair cannot be created'): + GsxResponse(xml=xml, el_method='CreateCarryInResponse', + el_response='repairConfirmation') + + class TestLookupFunctions(RemoteTestCase): def test_component_check(self): @@ -296,9 +304,16 @@ class TestPartFunction(RemoteTestCase): self.assertIsInstance(parts[0].partNumber, basestring) -class TestRemoteWarrantyFunctions(RemoteTestCase): +class TestRemoteWarrantyFunctions(TestCase): + @classmethod + def setUpClass(cls): + from gsxws.core import connect + connect(env['GSX_USER'], env['GSX_SOLDTO'], env['GSX_ENV']) + def setUp(self): super(TestRemoteWarrantyFunctions, self).setUp() + self.sn = env['GSX_SN'] + device = Product(sn=self.sn) self.product = Product(env['GSX_SN']) self.wty = self.product.warranty(ship_to=env['GSX_SHIPTO']) @@ -310,7 +325,7 @@ class TestRemoteWarrantyFunctions(RemoteTestCase): self.assertEqual(wty.warrantyStatus, 'Out Of Warranty (No Coverage)') def test_fmip_status(self): - self.assertContains(self.product.fmip_status, 'Find My iPhone is active') + self.assertIn('Find My iPhone is active', self.product.fmip_status) def test_fmip_active(self): self.assertTrue(self.product.fmip_is_active) |