From 79e4628a53f1cac06f6426b301dafa1351412702 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Fri, 7 Mar 2014 11:16:21 +0200 Subject: Added timestamp datatype, more tests --- tests/fixtures/escalation_details_lookup.xml | 29 ++++++++++++++++++++++++++++ tests/test_gsxws.py | 21 +++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/escalation_details_lookup.xml (limited to 'tests') diff --git a/tests/fixtures/escalation_details_lookup.xml b/tests/fixtures/escalation_details_lookup.xml new file mode 100644 index 0000000..6aa9335 --- /dev/null +++ b/tests/fixtures/escalation_details_lookup.xml @@ -0,0 +1,29 @@ + + + + + + 4ClHBDHhOL0NWdQMp4XBB + + 2392767 + GSX Help + O + GSX Usage Question + Apple + filipp Lepalaan + 03/06/14 09:01 PM + filipp Lepalaan + 03/06/14 09:06 PM + filipp Lepalaan + 03/06/14 09:02 PM + 4 minutes + + blaa + test + + + + + + + \ No newline at end of file diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 3cb1e06..5571c22 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import logging -from datetime import date from os import environ as env +from datetime import date, datetime from unittest import main, skip, TestCase @@ -29,6 +29,24 @@ class TestCoreFunctions(TestCase): self.assertRegexpMatches(rep.dumps(), 'ääöö') +class TestTypes(TestCase): + def setUp(self): + xml = open('tests/fixtures/escalation_details_lookup.xml', 'r').read() + self.data = parse(xml, 'lookupResponseData') + + def test_unicode(self): + self.assertIsInstance(self.data.lastModifiedBy, unicode) + + def test_timestamp(self): + self.assertIsInstance(self.data.createTimestamp, datetime) + + def test_ts_comp(self): + self.assertGreater(datetime.now(), self.data.createTimestamp) + + def test_list(self): + self.assertIsInstance(self.data.escalationNotes, list) + + class TestErrorFunctions(TestCase): def setUp(self): xml = open('tests/fixtures/multierror.xml', 'r').read() @@ -251,6 +269,7 @@ class TestRepairUpdate(RemoteTestCase): result = self.repair.set_techid('XXXXX') self.assertEqual(result.confirmationNumber, self.dispatchId) + class TestCarryinRepairDetail(TestCase): def setUp(self): self.data = parse('tests/fixtures/repair_details_ca.xml', -- cgit v1.2.3