diff options
author | Filipp Lepalaan <f@230.to> | 2013-10-07 11:57:17 +0300 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2013-10-07 11:57:17 +0300 |
commit | 7cec1e997840b2b3b2decab789c5f0f4a2fe23e5 (patch) | |
tree | 9fb5e7736d23e2dbe972512ed2497de6c309b58e | |
parent | 86a6df80b0e40855097fcf836cf11bd4808882f6 (diff) | |
download | py-gsxws-7cec1e997840b2b3b2decab789c5f0f4a2fe23e5.tar.gz py-gsxws-7cec1e997840b2b3b2decab789c5f0f4a2fe23e5.tar.bz2 py-gsxws-7cec1e997840b2b3b2decab789c5f0f4a2fe23e5.zip |
Added Component Check to lookups.py
-rw-r--r-- | gsxws/lookups.py | 17 | ||||
-rw-r--r-- | 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() |