aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gsxws/objectify.py5
-rw-r--r--tests/warranty_status.xml40
2 files changed, 42 insertions, 3 deletions
diff --git a/gsxws/objectify.py b/gsxws/objectify.py
index 979ec33..f1dd7ae 100644
--- a/gsxws/objectify.py
+++ b/gsxws/objectify.py
@@ -45,7 +45,6 @@ class GsxElement(StringElement):
class GsxDateElement(GsxElement):
@property
def pyval(self):
- # looks like some sort of date, let's try to convert
try:
# standard GSX format: "mm/dd/yy"
return datetime.strptime(self.text, "%m/%d/%y").date()
@@ -83,7 +82,7 @@ class GsxAttachment(GsxElement):
class GsxDatetimeElement(GsxElement):
@property
def pyval(self):
- #2011-01-27 11:45:01 PST
+ # 2011-01-27 11:45:01 PST
# Unfortunately we have to chomp off the TZ info...
m = re.search(r'^(\d+\-\d+\-\d+ \d+:\d+:\d+) (\w+)$', self.text)
ts, tz = m.groups()
@@ -116,7 +115,7 @@ class GsxClassLookup(objectify.ObjectifyElementClassLookup):
def parse(root, response):
"""
- >>> parse('/tmp/authenticate.xml', 'AuthenticateResponse').userSessionId
+ >>> parse('../tests/warranty_status.xml', 'warrantyDetailInfo').estimatedPurchaseDate
Sdt7tXp2XytTEVwHBeDx6lHTXI3w9s+M
"""
parser = objectify.makeparser(remove_blank_text=True)
diff --git a/tests/warranty_status.xml b/tests/warranty_status.xml
new file mode 100644
index 0000000..9712590
--- /dev/null
+++ b/tests/warranty_status.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+ <S:Body>
+ <ns3:WarrantyStatusResponse xmlns:ns2="http://asp.core.endpoint.ws.gsx.ist.apple.com/" xmlns:ns3="http://gsxws.apple.com/elements/global" xmlns:ns4="http://gsxws.apple.com/elements/core/asp" xmlns:ns5="http://gsxws.apple.com/elements/core/asp/am" xmlns:ns6="http://gsxws.apple.com/elements/core">
+ <WarrantyStatusResponse>
+ <operationId>5fdef1309390619199</operationId>
+ <warrantyDetailInfo>
+ <serialNumber>70033CDFA4S</serialNumber>
+ <warrantyStatus>Apple Limited Warranty</warrantyStatus>
+ <coverageEndDate>08/24/11</coverageEndDate>
+ <coverageStartDate>08/25/10</coverageStartDate>
+ <daysRemaining>0</daysRemaining>
+ <estimatedPurchaseDate>08/25/10</estimatedPurchaseDate>
+ <globalWarranty/>
+ <purchaseCountry>United States</purchaseCountry>
+ <registrationDate>08/25/10</registrationDate>
+ <imageURL>http://service.info.apple.com/parts/service_parts/products/iphone4.jpg</imageURL>
+ <explodedViewURL>http://service.info.apple.com/parts/service_parts/ev/iphone4.ev.pdf</explodedViewURL>
+ <manualURL>http://download.info.apple.com/Apple_Support_Area/Misc/Service/servicemanuals/</manualURL>
+ <productDescription>iPhone 4</productDescription>
+ <configDescription>IPHONE 4,16GB BLACK</configDescription>
+ <slaGroupDescription/>
+ <ecorathFlag/>
+ <powerTrainFlag/>
+ <triCareFlag/>
+ <contractCoverageEndDate/>
+ <contractCoverageStartDate/>
+ <contractType/>
+ <laborCovered>Y</laborCovered>
+ <limitedWarranty>Y</limitedWarranty>
+ <partCovered>Y</partCovered>
+ <warrantyReferenceNo/>
+ <isPersonalized/>
+ <acPlusFlag>Y</acPlusFlag>
+ </warrantyDetailInfo>
+ <communicationMessage/>
+ </WarrantyStatusResponse>
+ </ns3:WarrantyStatusResponse>
+ </S:Body>
+</S:Envelope>