aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-08-14 15:49:05 +0300
committerFilipp Lepalaan <filipp@mac.com>2015-08-14 15:49:05 +0300
commit491d967f2e0d6fc62724746a430fe27a9421e639 (patch)
tree2d7f3b65ba94f80b2aad605b27450b569fa5f7f7
parent9de65245974305a17637fd8711f3a88b5ff9db22 (diff)
downloadpy-gsxws-491d967f2e0d6fc62724746a430fe27a9421e639.tar.gz
py-gsxws-491d967f2e0d6fc62724746a430fe27a9421e639.tar.bz2
py-gsxws-491d967f2e0d6fc62724746a430fe27a9421e639.zip
Return symptoms and issues as two-tuples
-rw-r--r--gsxws/repairs.py13
-rw-r--r--tests/test_gsxws.py17
2 files changed, 21 insertions, 9 deletions
diff --git a/gsxws/repairs.py b/gsxws/repairs.py
index b7716ae..d84372c 100644
--- a/gsxws/repairs.py
+++ b/gsxws/repairs.py
@@ -54,9 +54,20 @@ class SymptomIssue(GsxObject):
_namespace = "asp:"
def fetch(self):
+ result = []
self._submit("requestData", "ReportedSymptomIssue",
"ReportedSymptomIssueResponse")
- return self._req.objects.reportedSymptomIssueResponse
+ r = self._req.objects.reportedSymptomIssueResponse
+
+ if r.symptoms is not None:
+ for s in r.symptoms:
+ result.append((s.reportedSymptomCode, s.reportedSymptomDesc,))
+
+ if r.issues is not None:
+ for s in r.issues:
+ result.append((s.reportedIssueCode, s.reportedIssueDesc,))
+
+ return result
class CompTiaCode(GsxObject):
diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py
index 0a8970b..bd2d8b0 100644
--- a/tests/test_gsxws.py
+++ b/tests/test_gsxws.py
@@ -104,10 +104,10 @@ class RepairTestCase(RemoteTestCase):
_comptia.comptiaCode = ccode
self.comptia = _comptia
- r = repairs.SymptomIssue(serialNumber=self.sn).fetch()
- self.symptom = r.symptoms[0].reportedSymptomCode
- r = repairs.SymptomIssue(reportedSymptomCode=self.symptom).fetch()
- self.issue = r.issues[0].reportedIssueCode
+ self._symptoms = repairs.SymptomIssue(serialNumber=self.sn).fetch()
+ self.symptom = self._symptoms[0][0]
+ self._issues = repairs.SymptomIssue(reportedSymptomCode=self.symptom).fetch()
+ self.issue = self._issues[0][0]
class TestCoreFunctions(TestCase):
@@ -210,10 +210,11 @@ class TestEscalationFunctions(RemoteTestCase):
class TestRepairFunctions(RepairTestCase):
- def test_symptom_issue(self):
- from gsxws.repairs import SymptomIssue
- r = SymptomIssue(serialNumber=env['GSX_SN']).fetch()
- self.assertEqual(r.symptoms[0].reportedSymptomCode, 6115)
+ def test_symptom_code(self):
+ self.assertEqual(self._symptoms[0][0], 'PD17A')
+
+ def test_issue_code(self):
+ self.assertEqual(self._issues[0][0], 'PD17-01')
def test_create_carryin(self):
rep = repairs.CarryInRepair()