aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_gsxws.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_gsxws.py')
-rw-r--r--tests/test_gsxws.py67
1 files changed, 61 insertions, 6 deletions
diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py
index d7feac6..089d916 100644
--- a/tests/test_gsxws.py
+++ b/tests/test_gsxws.py
@@ -1,21 +1,76 @@
# -*- coding: utf-8 -*-
-import unittest
from datetime import date
+from unittest import main, TestCase
from gsxws.objectify import parse
-class TestWarrantyFunctions(unittest.TestCase):
+class TestWarrantyFunctions(TestCase):
def setUp(self):
- self.wty = parse('tests/fixtures/warranty_status.xml', 'warrantyDetailInfo')
+ self.data = parse('tests/fixtures/warranty_status.xml', 'warrantyDetailInfo')
def test_purchase_date(self):
- self.assertIsInstance(self.wty.estimatedPurchaseDate.pyval, date)
+ self.assertIsInstance(self.data.estimatedPurchaseDate, date)
def test_config_description(self):
- self.assertEqual(self.wty.configDescription, 'IPHONE 4,16GB BLACK')
+ self.assertEqual(self.data.configDescription, 'IPHONE 4,16GB BLACK')
+ def test_limited_warranty(self):
+ self.assertTrue(self.data.limitedWarranty)
+
+ def test_parts_covered(self):
+ self.assertIsInstance(self.data.partCovered, bool)
+ self.assertTrue(self.data.partCovered)
+
+
+class TestActivation(TestCase):
+ def setUp(self):
+ self.data = parse('tests/fixtures/ios_activation.xml', 'activationDetailsInfo')
+
+ def test_unlock_date(self):
+ self.assertIsInstance(self.data.unlockDate, date)
+
+ def test_unlocked(self):
+ self.assertIs(type(self.data.unlocked), bool)
+ self.assertTrue(self.data.unlocked)
+
+
+class TestPartsLookup(TestCase):
+ def setUp(self):
+ self.data = parse('tests/fixtures/parts_lookup.xml', 'PartsLookupResponse')
+ self.part = self.data.parts[0]
+
+ def test_parts(self):
+ self.assertEqual(len(self.data.parts), 3)
+
+ def test_exchange_price(self):
+ self.assertEqual(self.part.exchangePrice, 14.4)
+
+ def test_stock_price(self):
+ self.assertEqual(self.part.stockPrice, 17.1)
+
+ def test_serialized(self):
+ self.assertIsInstance(self.part.isSerialized, bool)
+ self.assertTrue(self.part.isSerialized)
+
+ def test_description(self):
+ self.assertEqual(self.part.partDescription, 'SVC,REMOTE')
+
+
+class TestOnsiteDispatchDetail(TestCase):
+ def setUp(self):
+ self.data = parse('tests/fixtures/onsite_dispatch_detail.xml', 'onsiteDispatchDetails')
+
+ def test_details(self):
+ self.assertEqual(self.data.dispatchId, 'G101260028')
+
+ def test_address(self):
+ self.assertEqual(self.data.primaryAddress.zipCode, 85024)
+ self.assertEqual(self.data.primaryAddress.firstName, 'Christopher')
+
+ def test_orderlines(self):
+ self.assertIsInstance(self.data.dispatchOrderLines.isSerialized, bool)
if __name__ == '__main__':
- unittest.main()
+ main()