aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-11-18 22:43:07 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-11-18 22:43:07 +0200
commit8bf05b0b5c600445c28cf7e2033c1b6213d11982 (patch)
tree8edbc77fb42407216f3d041189bca0ac6cece358
parent1bf79e5f9bcdc4b82bf36890ed8050fe5dd505b3 (diff)
downloadpy-gsxws-8bf05b0b5c600445c28cf7e2033c1b6213d11982.tar.gz
py-gsxws-8bf05b0b5c600445c28cf7e2033c1b6213d11982.tar.bz2
py-gsxws-8bf05b0b5c600445c28cf7e2033c1b6213d11982.zip
Store symptom codes as two-tuples instead
-rw-r--r--gsxws/comptia.py4
-rw-r--r--tests/test_gsxws.py18
2 files changed, 13 insertions, 9 deletions
diff --git a/gsxws/comptia.py b/gsxws/comptia.py
index a12c046..3cd47d7 100644
--- a/gsxws/comptia.py
+++ b/gsxws/comptia.py
@@ -68,10 +68,10 @@ class CompTIA(GsxObject):
root = doc.find('.//comptiaInfo')
for el in root.findall(".//comptiaGroup"):
- group = {}
+ group = []
comp_id = unicode(el[0].text)
for ci in el.findall("comptiaCodeInfo"):
- group[ci[0].text] = unicode(ci[1].text)
+ group.append((ci[0].text, unicode(ci[1].text)),)
self._comptia[comp_id] = group
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(), '<GsxObject><blaa>ääöö</blaa><orderLines>')
+ self.assertRegexpMatches(rep.dumps(),
+ '<GsxObject><blaa>ääöö</blaa><orderLines>')
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()