diff options
-rw-r--r-- | gsxws/comms.py | 2 | ||||
-rw-r--r-- | gsxws/repairs.py | 18 | ||||
-rw-r--r-- | tests/test_gsxws.py | 35 |
3 files changed, 50 insertions, 5 deletions
diff --git a/gsxws/comms.py b/gsxws/comms.py index 59e7f23..c2896fb 100644 --- a/gsxws/comms.py +++ b/gsxws/comms.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + from core import GsxObject diff --git a/gsxws/repairs.py b/gsxws/repairs.py index be01a1b..79049fb 100644 --- a/gsxws/repairs.py +++ b/gsxws/repairs.py @@ -45,7 +45,6 @@ class RepairOrderLine(GsxObject): class ServicePart(GsxObject): "A generic service part (for PartInfo and whatnot)" - def __init__(self, number, *args, **kwargs): super(ServicePart, self).__init__(*args, **kwargs) @@ -57,12 +56,9 @@ class ServicePart(GsxObject): class Repair(GsxObject): "Base class for the different GSX Repair types" - def __init__(self, number=None, **kwargs): - self._namespace = "asp:" super(Repair, self).__init__(**kwargs) - if number is not None: self.dispatchId = number @@ -267,6 +263,20 @@ class IndirectOnsiteRepair(Repair): "repairConfirmation") +class WholeUnitExchange(Repair): + """ + The Create Whole Unit Exchange API allows the service providers to send + all the information required to create a whole unit exchange repair. + GSX validates the information and if all the validations go through, + it obtains a quote for repair and creates the whole unit exchange repair. + The quote is sent as part of the response. + If a validation error occurs, a fault code is issued. + """ + def create(self): + self._namespace = "asp:" + return self._submit("repairData", "CreateWholeUnitExchange", "repairConfirmation") + + if __name__ == '__main__': import doctest from core import connect diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 6982542..c24217c 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -1,11 +1,43 @@ # -*- coding: utf-8 -*- +import logging from datetime import date -from unittest import main, TestCase +from unittest import main, skip, TestCase +from gsxws import repairs from gsxws.objectify import parse +class TestRepairFunctions(TestCase): + @skip("Skip") + def test_whole_unit_exchange(self): + from gsxws.core import connect + logging.basicConfig(level=logging.DEBUG) + connect('', '', '', 'it') + rep = repairs.WholeUnitExchange() + rep.serialNumber = '' + rep.unitReceivedDate = '08/12/2013' + rep.unitReceivedTime = '11:00 am' + rep.shipTo = '677592' + rep.poNumber = '677592' + 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 + part = repairs.RepairOrderLine() + part.partNumber = '661-5571' + rep.orderLines = [part] + rep.create() + + class TestWarrantyFunctions(TestCase): def setUp(self): self.data = parse('tests/fixtures/warranty_status.xml', 'warrantyDetailInfo') @@ -76,5 +108,6 @@ class TestOnsiteDispatchDetail(TestCase): def test_orderlines(self): self.assertIsInstance(self.data.dispatchOrderLines.isSerialized, bool) + if __name__ == '__main__': main() |