From f1e1789e1a9cdebf5268d0fa3dd2846178669777 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sun, 8 Sep 2013 22:34:08 +0300 Subject: Return None instead of AttributeError --- tests/test_gsxws.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'tests/test_gsxws.py') 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)) -- cgit v1.2.3