diff options
-rw-r--r-- | gsxws/escalations.py | 4 | ||||
-rw-r--r-- | gsxws/repairs.py | 20 | ||||
-rw-r--r-- | tests/test_gsxws.py | 48 |
3 files changed, 61 insertions, 11 deletions
diff --git a/gsxws/escalations.py b/gsxws/escalations.py index 1ad2706..70f7732 100644 --- a/gsxws/escalations.py +++ b/gsxws/escalations.py @@ -86,6 +86,10 @@ class Escalation(GsxObject): return Lookup(escalationId=self.escalationId).lookup("GeneralEscalationDetailsLookup") def get_notes(self): + """ + Returns all the notes of this escalation. + Should probably be run after a lookup() + """ return self.objects.escalationNotes.iterchildren() diff --git a/gsxws/repairs.py b/gsxws/repairs.py index 502b9d6..dd9afd3 100644 --- a/gsxws/repairs.py +++ b/gsxws/repairs.py @@ -297,6 +297,26 @@ class IndirectOnsiteRepair(Repair): "repairConfirmation") +class RepairOrReplace(Repair): + """ + The Create Repair or Replace API allows users to submit Repair-Or-Replace information to GSX. + The submissions creates a GSX RoR Repair in the system. + """ + COVERAGE_OPTIONS = ( + ('N', 'No Damage'), + ('A1', 'Battery Service'), + ('A2', 'Returnable Damage'), + ('A3', 'Non-returnable Damage'), + ('X', 'Non-returnable damage covered by AppleCare+'), + ('RPL', 'Replace'), + ('Z', 'Override to Out of Warranty when part is covered by Variable Warranty') + ) + + def create(self): + self._namespace = "asp:" + return self._submit("repairData", "CreateRepairOrReplace", "repairConfirmation") + + class WholeUnitExchange(Repair): """ The Create Whole Unit Exchange API allows the service providers to send diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index b400639..5012a1b 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -20,6 +20,21 @@ class RemoteTestCase(TestCase): env['GSX_ENV']) +class RepairTestCase(RemoteTestCase): + def setUp(self): + super(RepairTestCase, self).setUp() + customer = repairs.Customer(emailAddress='test@example.com') + customer.firstName = 'First Name' + customer.lastName = 'Last Name' + customer.addressLine1 = 'Address Line 1' + customer.primaryPhone = '0123456789' + customer.city = 'Test' + customer.zipCode = '12345' + customer.state = 'VIC' + customer.country = 'AU' + self.customer = customer + + class TestCoreFunctions(TestCase): def test_dump(self): rep = repairs.Repair(blaa=u'ääöö') @@ -121,7 +136,27 @@ class TestEscalationFunctions(RemoteTestCase): self.assertEqual(result.escalationType, 'GSX Help') -class TestRepairFunctions(RemoteTestCase): +class TestRepairFunctions(RepairTestCase): + def test_repair_or_replace(self): + rep = repairs.RepairOrReplace() + rep.serialNumber = env['GSX_SN'] + rep.unitReceivedDate = '03/20/2014' + rep.unitReceivedTime = '11:00 am' + rep.shipTo = env['GSX_SHIPTO'] + rep.purchaseOrderNumber = '123456' + rep.coverageOptions = 'A1' + rep.symptom = 'test' + rep.diagnosis = 'test' + rep.shipper = 'XUPSN' + rep.trackingNumber = '123456' + rep.customerAddress = self.customer + part = repairs.RepairOrderLine() + part.partNumber = 'X661-5256' + part.comptiaCode = 'X01' + part.comptiaModifier = 'A' + rep.orderLines = [part] + rep.create() + @skip("Skip") def test_whole_unit_exchange(self): rep = repairs.WholeUnitExchange() @@ -132,16 +167,7 @@ class TestRepairFunctions(RemoteTestCase): rep.poNumber = '' rep.symptom = 'test' rep.diagnosis = 'test' - customer = repairs.Customer(emailAddress='test@example.com') - customer.firstName = 'First Name' - customer.lastName = 'Last Name' - customer.addressLine1 = 'Address Line 1' - customer.primaryPhone = '0123456789' - customer.city = 'Test' - customer.zipCode = '12345' - customer.state = 'Test' - customer.country = 'US' - rep.customerAddress = customer + rep.customerAddress = self.customer part = repairs.RepairOrderLine() part.partNumber = '661-5571' rep.orderLines = [part] |