diff options
-rw-r--r-- | gsxws/repairs.py | 4 | ||||
-rw-r--r-- | tests/test_gsxws.py | 11 |
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): |