diff options
author | Filipp Lepalaan <filipp@mac.com> | 2014-08-16 14:20:54 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2014-08-16 14:20:54 +0300 |
commit | 09ef2e20882af372ccdc71923c9f15a8f16f8443 (patch) | |
tree | 7458dcf38d50ca62fd04fbd4a730a20859a8f226 | |
parent | 4205a0bc86af65fc4554de01cfcd21ed5b2b4c01 (diff) | |
download | py-gsxws-09ef2e20882af372ccdc71923c9f15a8f16f8443.tar.gz py-gsxws-09ef2e20882af372ccdc71923c9f15a8f16f8443.tar.bz2 py-gsxws-09ef2e20882af372ccdc71923c9f15a8f16f8443.zip |
Added ShipTo argument to warranty check
-rw-r--r-- | gsxws/core.py | 8 | ||||
-rw-r--r-- | gsxws/products.py | 5 | ||||
-rw-r--r-- | tests/test_gsxws.py | 9 |
3 files changed, 16 insertions, 6 deletions
diff --git a/gsxws/core.py b/gsxws/core.py index 413e3fe..79b5687 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -478,10 +478,10 @@ def connect(user_id, password, sold_to, global GSX_LOCALE global GSX_REGION - GSX_LANG = language - GSX_REGION = region - GSX_LOCALE = locale - GSX_ENV = environment + GSX_LANG = language + GSX_REGION = region + GSX_LOCALE = locale + GSX_ENV = environment act = GsxSession(user_id, password, sold_to, language, timezone) return act.login() diff --git a/gsxws/products.py b/gsxws/products.py index b1bd5a7..f0bab00 100644 --- a/gsxws/products.py +++ b/gsxws/products.py @@ -49,7 +49,7 @@ class Product(object): self.configCode = result.configCode return result - def warranty(self, parts=[], date_received=None): + def warranty(self, parts=[], date_received=None, ship_to=None): """ The Warranty Status API retrieves the same warranty details displayed on the GSX Coverage screen. @@ -71,6 +71,9 @@ class Product(object): if self.should_check_activation: self.activation() + if ship_to: + self._gsx.shipTo = ship_to + try: self._gsx.partNumbers = [] for k, v in parts: diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 8f11633..1de1906 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -181,7 +181,14 @@ class TestPartFunction(RemoteTestCase): self.assertIsInstance(parts[0].partNumber, basestring) -class TestWarrantyFunctions(TestCase): +class TestRemoteWarrantyFunctions(RemoteTestCase): + def test_warranty_lookup(self): + product = Product('DGKFL06JDHJP') + wty = product.warranty(ship_to=env['GSX_SHIPTO']) + self.assertEqual(wty.warrantyStatus, 'Out Of Warranty (No Coverage)') + + +class TestLocalWarrantyFunctions(TestCase): def setUp(self): self.data = parse('tests/fixtures/warranty_status.xml', 'warrantyDetailInfo') |