From 7cec1e997840b2b3b2decab789c5f0f4a2fe23e5 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 7 Oct 2013 11:57:17 +0300 Subject: Added Component Check to lookups.py --- gsxws/lookups.py | 17 +++++++++++++++++ tests/test_gsxws.py | 19 +++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/gsxws/lookups.py b/gsxws/lookups.py index 7513151..ea9143a 100644 --- a/gsxws/lookups.py +++ b/gsxws/lookups.py @@ -62,6 +62,23 @@ class Lookup(GsxObject): result.invoiceData = outfile.name return result + def component_check(self): + """ + The Component Check API allows service providers to send + the information required to create a repair and check if + the repair is eligible for component serial number verification + for certain components listed in response. + If service providers will not be able to provide these component + serial numbers, the repairs will not be created until service providers + choose an option to send the repair for Component Check Review. + GSX validates the information and, if all the validations go through, + it obtains a status message explaining if the repair + is eligible for Component Serial Number verification + and lists the component codes for which component serial numbers are required. + """ + return self._submit("repairData", "ComponentCheck", + "componentCheckDetails") + if __name__ == '__main__': import sys diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 59c0662..952c6fc 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -8,13 +8,12 @@ from unittest import main, skip, TestCase from gsxws.objectify import parse from gsxws.products import Product -from gsxws import repairs, escalations, GsxError +from gsxws import repairs, escalations, lookups, GsxError class RemoteTestCase(TestCase): def setUp(self): from gsxws.core import connect - logging.basicConfig(level=logging.DEBUG) connect(env['GSX_USER'], env['GSX_PASSWORD'], env['GSX_SOLDTO'], @@ -29,10 +28,20 @@ class TestErrorFunctions(TestCase): def test_code(self): self.assertEqual(self.data.errors['RPR.ONS.025'], 'This unit is not eligible for an Onsite repair from GSX.') + def test_message(self): self.assertRegexpMatches(self.data.message, 'Multiple error messages exist.') +class TestLookupFunctions(RemoteTestCase): + def test_component_check(self): + l = lookups.Lookup(serialNumber=env['GSX_SN']) + l.repairStrategy = "CA" + l.shipTo = env['GSX_SHIPTO'] + r = l.component_check() + self.assertFalse(r.eligibility) + + class TestEscalationFunctions(RemoteTestCase): @skip("Skip") def setUp(self): @@ -67,12 +76,9 @@ class TestEscalationFunctions(RemoteTestCase): self.assertEqual(result.escalationType, 'GSX Help') -class TestRepairFunctions(TestCase): +class TestRepairFunctions(RemoteTestCase): @skip("Skip") def test_whole_unit_exchange(self): - from gsxws.core import connect - logging.basicConfig(level=logging.DEBUG) - connect('', '', '', 'it') rep = repairs.WholeUnitExchange() rep.serialNumber = '' rep.unitReceivedDate = '08/12/2013' @@ -220,4 +226,5 @@ class TestCarryinRepairDetail(TestCase): if __name__ == '__main__': + logging.basicConfig(level=logging.DEBUG) main() -- cgit v1.2.3