From 8bf05b0b5c600445c28cf7e2033c1b6213d11982 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 18 Nov 2015 22:43:07 +0200 Subject: Store symptom codes as two-tuples instead --- tests/test_gsxws.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index db0c10d..c4924da 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -23,13 +23,15 @@ class RemoteTestCase(TestCase): connect(os.getenv('GSX_USER'), os.getenv('GSX_SOLDTO'), os.getenv('GSX_ENV')) self.sn = os.getenv('GSX_SN') device = Product(sn=self.sn) + comptia_codes = comptia.fetch() # pick the first part with a component code self.first_part = [x for x in device.parts() if not empty(x.componentCode)][0] self.part = repairs.RepairOrderLine() self.part.partNumber = os.getenv('GSX_PART', self.first_part.partNumber) - self.part.comptiaCode = 'X01' + comptia_code = comptia_codes[self.first_part.componentCode] + self.part.comptiaCode = comptia_code[0][0] self.part.comptiaModifier = 'A' def assertUnicodeOrInt(self, val): @@ -42,7 +44,7 @@ class RemoteTestCase(TestCase): class ComptiaTestCase(RemoteTestCase): def test_fetch_comptia(self): data = comptia.fetch() - self.assertIsInstance(data['E'], dict) + self.assertIsInstance(data['E'], list) class DiagnosticsTestCase(TestCase): @@ -116,8 +118,7 @@ class RepairTestCase(RemoteTestCase): _comptia = repairs.CompTiaCode(comptiaGroup=gcode) _comptia.comptiaModifier = comptia.MODIFIERS[0][0] - ccode, cdesc = cdata[gcode].popitem() - _comptia.comptiaCode = ccode + _comptia.comptiaCode = cdata[gcode][0][0] self.comptia = _comptia self._symptoms = repairs.SymptomIssue(serialNumber=self.sn).fetch() @@ -132,7 +133,8 @@ class TestCoreFunctions(TestCase): part = repairs.RepairOrderLine() part.partNumber = '661-5571' rep.orderLines = [part] - self.assertRegexpMatches(rep.dumps(), 'ääöö') + self.assertRegexpMatches(rep.dumps(), + 'ääöö') class TestTypes(TestCase): @@ -179,7 +181,6 @@ class TestErrorFunctions(TestCase): el_response='repairConfirmation') - class TestLookupFunctions(RemoteTestCase): def test_component_check(self): l = lookups.Lookup(serialNumber=os.getenv('GSX_SN')) @@ -311,13 +312,16 @@ class TestRepairFunctions(RepairTestCase): def test_whole_unit_exchange(self): rep = repairs.WholeUnitExchange() - rep.serialNumber = '' + rep.serialNumber = self.sn rep.unitReceivedDate = self.date rep.unitReceivedTime = self.time rep.shipTo = os.getenv('GSX_SHIPTO') rep.purchaseOrderNumber = '123456' rep.symptom = 'This is a test symptom' rep.diagnosis = 'This is a test diagnosis' + rep.poNumber = '123456' + rep.reportedSymptomCode = self.symptom + rep.reportedIssueCode = self.issue rep.customerAddress = self.customer rep.orderLines = [self.part] rep.create() -- cgit v1.2.3