diff options
author | Filipp Lepalaan <f@230.to> | 2013-09-06 22:02:11 +0300 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2013-09-06 22:02:11 +0300 |
commit | 36c1e480887902ff7ae0a03c6aa51bbf97a6d036 (patch) | |
tree | 0d70144c060e444de3b21dcbe2b04fc45ef4e016 | |
parent | f637233e97c1dee118097b25869a880df640ba8b (diff) | |
download | py-gsxws-36c1e480887902ff7ae0a03c6aa51bbf97a6d036.tar.gz py-gsxws-36c1e480887902ff7ae0a03c6aa51bbf97a6d036.tar.bz2 py-gsxws-36c1e480887902ff7ae0a03c6aa51bbf97a6d036.zip |
Added set_status and set_techid to shortcuts to Repair
-rw-r--r-- | gsxws/repairs.py | 18 | ||||
-rw-r--r-- | tests/test_gsxws.py | 31 |
2 files changed, 35 insertions, 14 deletions
diff --git a/gsxws/repairs.py b/gsxws/repairs.py index 79049fb..89eba81 100644 --- a/gsxws/repairs.py +++ b/gsxws/repairs.py @@ -17,6 +17,12 @@ REPAIR_TYPES = ( ('WH', "Mail-In"), ) +REPAIR_STATUSES = ( + ('AWTP', 'Awaiting Parts'), + ('AWTR', 'Parts Allocated'), + ('BEGR', 'In Repair'), + ('RFPU', 'Ready for Pickup') +) class Customer(GsxObject): """ @@ -215,12 +221,6 @@ class CarryInRepair(Repair): to a repair. On successful update, the repair confirmation number and quote for any newly added parts would be returned. In case of any validation error or unsuccessful update, a fault code is issued. - - Carry-In Repair Update Status Codes: - AWTP Awaiting Parts - AWTR Parts Allocated - BEGR In Repair - RFPU Ready for Pickup """ self._namespace = "asp:" @@ -232,6 +232,12 @@ class CarryInRepair(Repair): self._data.update(newdata) return self._submit("repairData", "UpdateCarryIn", "repairConfirmation") + def set_techid(self, new_techid): + return self.update({'technicianId': new_techid}) + + def set_status(self, new_status): + return self.update({'statusCode': new_status}) + class IndirectOnsiteRepair(Repair): """ diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 467a573..19c8d86 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -9,15 +9,19 @@ from gsxws.objectify import parse from gsxws.products import Product from gsxws import repairs, escalations - -class TestEscalationFunctions(TestCase): - @skip("Skip") +class RemoteTestCase(TestCase): def setUp(self): from gsxws.core import connect logging.basicConfig(level=logging.DEBUG) env = os.environ connect(env['GSX_USER'], env['GSX_PASSWORD'], env['GSX_SOLDTO'], env['GSX_ENV']) + +class TestEscalationFunctions(RemoteTestCase): + @skip("Skip") + def setUp(self): + super(TestEscalationFunctions, self).setUp() esc = escalations.Escalation() + env = os.environ esc.shipTo = env['GSX_SHIPTO'] esc.issueTypeCode = 'WS' esc.notes = 'This is a test' @@ -96,12 +100,9 @@ class TestWarrantyFunctions(TestCase): self.assertTrue(self.data.partCovered) -class TestOnsiteCoverage(TestCase): +class TestOnsiteCoverage(RemoteTestCase): def setUp(self): - from gsxws.core import connect - logging.basicConfig(level=logging.DEBUG) - env = os.environ - connect(env['GSX_USER'], env['GSX_PASSWORD'], env['GSX_SOLDTO'], env['GSX_ENV']) + super(TestOnsiteCoverage, self).setUp() self.product = Product('XXXXXXXXXXX') self.product.warranty() @@ -170,6 +171,20 @@ class TestOnsiteDispatchDetail(TestCase): self.assertIsInstance(self.data.dispatchOrderLines.isSerialized, bool) +class TestRepairUpdate(RemoteTestCase): + def setUp(self): + super(TestRepairUpdate, self).setUp() + self.dispatchId = 'G135934345' + self.repair = repairs.CarryInRepair(self.dispatchId) + + def test_set_repair_status(self): + result = self.repair.set_status('BEGR') + self.assertEqual(result.confirmationNumber, self.dispatchId) + + def test_set_repair_techid(self): + result = self.repair.set_techid('XXXXX') + self.assertEqual(result.confirmationNumber, self.dispatchId) + class TestCarryinRepairDetail(TestCase): def setUp(self): self.data = parse('tests/fixtures/repair_details_ca.xml', |