diff options
author | Filipp Lepalaan <f@230.to> | 2014-09-09 17:06:52 +0300 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2014-09-09 17:06:52 +0300 |
commit | 867e0d97fc5a71ed36190d06779c732f0f8d4aab (patch) | |
tree | 7201aee73ef3872fad3192eda4da48af6fe4868a | |
parent | eb17a89cf0a3ae367d50b9f3a12dfdf5621f9da8 (diff) | |
download | py-gsxws-867e0d97fc5a71ed36190d06779c732f0f8d4aab.tar.gz py-gsxws-867e0d97fc5a71ed36190d06779c732f0f8d4aab.tar.bz2 py-gsxws-867e0d97fc5a71ed36190d06779c732f0f8d4aab.zip |
Added FMiP support
-rw-r--r-- | gsxws/products.py | 18 | ||||
-rw-r--r-- | tests/test_gsxws.py | 15 |
2 files changed, 30 insertions, 3 deletions
diff --git a/gsxws/products.py b/gsxws/products.py index f0bab00..c085aeb 100644 --- a/gsxws/products.py +++ b/gsxws/products.py @@ -160,6 +160,24 @@ class Product(object): self._gsx.serialNumber = self.serialNumber return ad + + @property + def fmip_status(self, wty=None): + if wty is None: + wty = self.warrantyDetails + + if wty is None: + raise GsxError('Must run warranty status before FMiP status check') + + return wty.activationLockStatus or '' + + @property + def fmip_is_active(self): + """ + Returns True if FMiP status is active, False otherwise + """ + return self.fmip_status.startswith('Find My iPhone is active.') + def is_unlocked(self, ad=None): """ Returns true if this iOS device is unlocked diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index dc0f4aa..a4f1a21 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -199,10 +199,19 @@ class TestPartFunction(RemoteTestCase): class TestRemoteWarrantyFunctions(RemoteTestCase): + def setUp(self): + super(TestRemoteWarrantyFunctions, self).setUp() + self.product = Product(env['GSX_SN']) + self.wty = self.product.warranty(ship_to=env['GSX_SHIPTO']) + 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)') + self.assertEqual(self.wty.warrantyStatus, 'Out Of Warranty (No Coverage)') + + def test_fmip_status(self): + self.assertEqual(self.product.fmip_status, 'Find My iPhone is active. Find My iPhone must be turned off for whole unit repairs.') + + def test_fmip_active(self): + self.assertTrue(self.product.fmip_is_active) class TestLocalWarrantyFunctions(TestCase): |