aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-10-16 12:46:28 +0300
committerFilipp Lepalaan <filipp@mac.com>2015-10-16 12:46:28 +0300
commit98169c529f524c8f67f3fe6a30d62448214eafc6 (patch)
treef1f4694cb5ab50a9ae0dd4c62fc7c0a6dcced4e4
parent6db0dca11454849de98746eb906c8e264428f7a4 (diff)
downloadpy-gsxws-98169c529f524c8f67f3fe6a30d62448214eafc6.tar.gz
py-gsxws-98169c529f524c8f67f3fe6a30d62448214eafc6.tar.bz2
py-gsxws-98169c529f524c8f67f3fe6a30d62448214eafc6.zip
Fix for repairConfirmation/messages issue
-rw-r--r--gsxws/repairs.py4
-rw-r--r--tests/test_gsxws.py11
2 files changed, 11 insertions, 4 deletions
diff --git a/gsxws/repairs.py b/gsxws/repairs.py
index 47aacc3..768ff06 100644
--- a/gsxws/repairs.py
+++ b/gsxws/repairs.py
@@ -280,8 +280,8 @@ class CarryInRepair(Repair):
result = self._submit("repairData", "CreateCarryIn", "repairConfirmation")
if hasattr(result, 'repairConfirmation'):
- messages = result.repairConfirmation.messages
- raise GsxError(messages)
+ if hasattr(result.repairConfirmation, 'messages'):
+ raise GsxError(result.repairConfirmation.messages)
self.dispatchId = result.confirmationNumber
return result
diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py
index 146fa29..1c46f12 100644
--- a/tests/test_gsxws.py
+++ b/tests/test_gsxws.py
@@ -6,6 +6,7 @@ from datetime import date, datetime
from unittest import main, skip, TestCase
+from gsxws.core import validate
from gsxws.objectify import parse, gsx_diags_timestamp
from gsxws.products import Product
from gsxws import (repairs, escalations, lookups, returns,
@@ -27,7 +28,7 @@ class RemoteTestCase(TestCase):
self.first_part = [x for x in device.parts() if not empty(x.componentCode)][0]
self.part = repairs.RepairOrderLine()
- self.part.partNumber = self.first_part.partNumber
+ self.part.partNumber = os.getenv('GSX_PART', self.first_part.partNumber)
self.part.comptiaCode = 'X01'
self.part.comptiaModifier = 'A'
@@ -232,7 +233,6 @@ class TestEscalationFunctions(RemoteTestCase):
class TestSympomIssueFunctions(RemoteTestCase):
-
def setUp(self):
super(TestSympomIssueFunctions, self).setUp()
self._symptoms = repairs.SymptomIssue(serialNumber=self.sn).fetch()
@@ -262,6 +262,7 @@ class TestRepairFunctions(RepairTestCase):
rep.reportedSymptomCode = self.symptom
rep.reportedIssueCode = self.issue
rep.create()
+ self.assertTrue(validate(rep.dispatchId, 'dispatchId'))
def test_repair_or_replace(self):
rep = repairs.RepairOrReplace()
@@ -321,6 +322,12 @@ class TestRepairFunctions(RepairTestCase):
rep.orderLines = [self.part]
rep.create()
+ def test_mark_complete(self):
+ rep = repairs.Repair(os.getenv('GSX_DISPATCH'))
+ r = rep.mark_complete()
+ result = r.repairConfirmationNumbers.confirmationNumber
+ self.assertEqual(result, os.getenv('GSX_DISPATCH'))
+
class TestPartFunction(RemoteTestCase):
def test_product_parts(self):