aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-09-08 22:34:08 +0300
committerFilipp Lepalaan <f@230.to>2013-09-08 22:34:08 +0300
commitf1e1789e1a9cdebf5268d0fa3dd2846178669777 (patch)
tree965286e26e500854843f4fe095190982bf097b3e /tests
parent56be452b6d8485e598ce9f5a532f5adb548f5c2c (diff)
downloadpy-gsxws-f1e1789e1a9cdebf5268d0fa3dd2846178669777.tar.gz
py-gsxws-f1e1789e1a9cdebf5268d0fa3dd2846178669777.tar.bz2
py-gsxws-f1e1789e1a9cdebf5268d0fa3dd2846178669777.zip
Return None instead of AttributeError
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gsxws.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py
index 1018440..6146a2c 100644
--- a/tests/test_gsxws.py
+++ b/tests/test_gsxws.py
@@ -1,27 +1,28 @@
# -*- coding: utf-8 -*-
-import os
import logging
from datetime import date
+from os import environ as env
+
from unittest import main, skip, TestCase
from gsxws.objectify import parse
from gsxws.products import Product
from gsxws import repairs, escalations
+
class RemoteTestCase(TestCase):
def setUp(self):
from gsxws.core import connect
logging.basicConfig(level=logging.DEBUG)
- env = os.environ
connect(env['GSX_USER'], env['GSX_PASSWORD'], env['GSX_SOLDTO'], env['GSX_ENV'])
+
class TestEscalationFunctions(RemoteTestCase):
@skip("Skip")
def setUp(self):
super(TestEscalationFunctions, self).setUp()
esc = escalations.Escalation()
- env = os.environ
esc.shipTo = env['GSX_SHIPTO']
esc.issueTypeCode = 'WS'
esc.notes = 'This is a test'
@@ -81,6 +82,12 @@ class TestRepairFunctions(TestCase):
rep.create()
+class TestPartFunction(RemoteTestCase):
+ def test_product_parts(self):
+ parts = Product(env['GSX_SN']).parts()
+ self.assertIsInstance(parts[0].partNumber, basestring)
+
+
class TestWarrantyFunctions(TestCase):
def setUp(self):
self.data = parse('tests/fixtures/warranty_status.xml',
@@ -103,7 +110,7 @@ class TestWarrantyFunctions(TestCase):
class TestOnsiteCoverage(RemoteTestCase):
def setUp(self):
super(TestOnsiteCoverage, self).setUp()
- self.product = Product('XXXXXXXXXXX')
+ self.product = Product(env['GSX_SN'])
self.product.warranty()
def test_has_onsite(self):
@@ -128,7 +135,7 @@ class TestActivation(TestCase):
self.assertIs(type(self.data.unlocked), bool)
self.assertTrue(self.data.unlocked)
- p = Product('XXXXXXXXXXX')
+ p = Product(env['GSX_SN'])
self.assertTrue(p.is_unlocked(self.data))