From 1f4ac1d6144dd79606942a742530845658309463 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sun, 9 Jun 2013 12:13:45 +0300 Subject: Make previous change pass some tests --- gsxws/core.py | 1 - gsxws/products.py | 16 ++++++++-------- gsxws/repairs.py | 9 ++++++--- gsxws/xmltodict.py | 4 ++++ 4 files changed, 18 insertions(+), 12 deletions(-) (limited to 'gsxws') diff --git a/gsxws/core.py b/gsxws/core.py index c70cd36..4dd50e5 100644 --- a/gsxws/core.py +++ b/gsxws/core.py @@ -264,7 +264,6 @@ class GsxRequest(object): logging.debug("Response: %s %s %s" % (res.status, res.reason, xml)) response = response or self._response - logging.debug("Looking for %s" % response) root = ET.fromstring(xml).find("*//%s" % response) data = xmltodict.ConvertXmlToDict(root) self.objects = data[response] diff --git a/gsxws/products.py b/gsxws/products.py index d3c1860..96352f1 100644 --- a/gsxws/products.py +++ b/gsxws/products.py @@ -11,7 +11,7 @@ from core import GsxObject, GsxError def models(): """ >>> models() # doctest: +ELLIPSIS - {'iphone_acc': {'models': 'Bluetooth Headset',... + {'MAC_ACC': {'models': ['AirPort Card', ... """ import os import yaml @@ -48,28 +48,28 @@ class Product(GsxObject): >>> Product('DGKFL06JDHJP').warranty().warrantyStatus u'Out Of Warranty (No Coverage)' >>> Product('DGKFL06JDHJP').warranty().estimatedPurchaseDate - '2011-06-02' + datetime.date(2011, 6, 2) """ self._submit("unitDetail", "WarrantyStatus", "warrantyDetailInfo") - self.warrantyDetails = self._req.objects[0] + self.warrantyDetails = self._req.objects return self.warrantyDetails def parts(self): """ >>> Product('DGKFL06JDHJP').parts() # doctest: +ELLIPSIS - [>> Product(productName='MacBook Pro (17-inch, Mid 2009)').parts() # doctest: +ELLIPSIS - [>> Product(serialNumber='DGKFL06JDHJP').repairs() # doctest: +ELLIPSIS - >> Repair('G135762375').update_sn(ServicePart('661-4964', oldSerialNumber='W882300FK22YA')) + Traceback (most recent call last): + ... + GsxError: This repair cannot be updated. """ self.partInfo = parts if hasattr(self, "dispatchId"): @@ -113,7 +116,7 @@ class Repair(GsxObject): to retrieve more details of the repair. >>> Repair(repairStatus='Open').lookup() #doctest: +ELLIPSIS - [>> Repair('G135773004').details() #doctest: +ELLIPSIS -