From 86af9609f17a8e34004faa991854f62d3361685f Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 16 Jul 2013 18:53:41 +0300 Subject: Reorganized tests --- gsxws/objectify.py | 15 ++++----- tests/__init__.py | 0 tests/acknowledge_communication.json | 5 --- tests/create_app_order.json | 18 ---------- tests/create_carryin_repair.json | 43 ------------------------ tests/create_cnd_repair.json | 21 ------------ tests/create_escalation.json | 11 ------ tests/create_srf_order.json | 9 ----- tests/create_stocking_order.json | 8 ----- tests/create_whole_unit_exchange.json | 32 ------------------ tests/fetch_communication_articles.json | 7 ---- tests/fetch_communication_content.json | 4 --- tests/fetch_ios_activation.json | 3 -- tests/fixtures/acknowledge_communication.json | 5 +++ tests/fixtures/create_app_order.json | 18 ++++++++++ tests/fixtures/create_carryin_repair.json | 43 ++++++++++++++++++++++++ tests/fixtures/create_cnd_repair.json | 21 ++++++++++++ tests/fixtures/create_escalation.json | 11 ++++++ tests/fixtures/create_srf_order.json | 9 +++++ tests/fixtures/create_stocking_order.json | 8 +++++ tests/fixtures/create_whole_unit_exchange.json | 32 ++++++++++++++++++ tests/fixtures/fetch_communication_articles.json | 7 ++++ tests/fixtures/fetch_communication_content.json | 4 +++ tests/fixtures/fetch_ios_activation.json | 3 ++ tests/fixtures/parts_lookup.json | 3 ++ tests/fixtures/parts_pending_return.json | 3 ++ tests/fixtures/parts_register_return.json | 15 +++++++++ tests/fixtures/parts_return_update.json | 12 +++++++ tests/fixtures/pending_app_orders.json | 4 +++ tests/fixtures/register_bulk_return.json | 13 +++++++ tests/fixtures/repair_lookup.json | 19 +++++++++++ tests/fixtures/return_label.json | 4 +++ tests/fixtures/return_report.json | 4 +++ tests/fixtures/update_carryin_repair.json | 13 +++++++ tests/fixtures/update_escalation.json | 8 +++++ tests/fixtures/update_serial_number.json | 12 +++++++ tests/fixtures/warranty_status.json | 3 ++ tests/fixtures/warranty_status.xml | 40 ++++++++++++++++++++++ tests/parts_lookup.json | 3 -- tests/parts_pending_return.json | 3 -- tests/parts_register_return.json | 15 --------- tests/parts_return_update.json | 12 ------- tests/pending_app_orders.json | 4 --- tests/register_bulk_return.json | 13 ------- tests/repair_lookup.json | 19 ----------- tests/return_label.json | 4 --- tests/return_report.json | 4 --- tests/test_gsxws.py | 21 ++++++++++++ tests/update_carryin_repair.json | 13 ------- tests/update_escalation.json | 8 ----- tests/update_serial_number.json | 12 ------- tests/warranty_status.json | 3 -- tests/warranty_status.xml | 40 ---------------------- 53 files changed, 342 insertions(+), 322 deletions(-) create mode 100644 tests/__init__.py delete mode 100644 tests/acknowledge_communication.json delete mode 100644 tests/create_app_order.json delete mode 100644 tests/create_carryin_repair.json delete mode 100644 tests/create_cnd_repair.json delete mode 100644 tests/create_escalation.json delete mode 100644 tests/create_srf_order.json delete mode 100644 tests/create_stocking_order.json delete mode 100644 tests/create_whole_unit_exchange.json delete mode 100644 tests/fetch_communication_articles.json delete mode 100644 tests/fetch_communication_content.json delete mode 100644 tests/fetch_ios_activation.json create mode 100644 tests/fixtures/acknowledge_communication.json create mode 100644 tests/fixtures/create_app_order.json create mode 100644 tests/fixtures/create_carryin_repair.json create mode 100644 tests/fixtures/create_cnd_repair.json create mode 100644 tests/fixtures/create_escalation.json create mode 100644 tests/fixtures/create_srf_order.json create mode 100644 tests/fixtures/create_stocking_order.json create mode 100644 tests/fixtures/create_whole_unit_exchange.json create mode 100644 tests/fixtures/fetch_communication_articles.json create mode 100644 tests/fixtures/fetch_communication_content.json create mode 100644 tests/fixtures/fetch_ios_activation.json create mode 100644 tests/fixtures/parts_lookup.json create mode 100644 tests/fixtures/parts_pending_return.json create mode 100644 tests/fixtures/parts_register_return.json create mode 100644 tests/fixtures/parts_return_update.json create mode 100644 tests/fixtures/pending_app_orders.json create mode 100644 tests/fixtures/register_bulk_return.json create mode 100644 tests/fixtures/repair_lookup.json create mode 100644 tests/fixtures/return_label.json create mode 100644 tests/fixtures/return_report.json create mode 100644 tests/fixtures/update_carryin_repair.json create mode 100644 tests/fixtures/update_escalation.json create mode 100644 tests/fixtures/update_serial_number.json create mode 100644 tests/fixtures/warranty_status.json create mode 100644 tests/fixtures/warranty_status.xml delete mode 100644 tests/parts_lookup.json delete mode 100644 tests/parts_pending_return.json delete mode 100644 tests/parts_register_return.json delete mode 100644 tests/parts_return_update.json delete mode 100644 tests/pending_app_orders.json delete mode 100644 tests/register_bulk_return.json delete mode 100644 tests/repair_lookup.json delete mode 100644 tests/return_label.json delete mode 100644 tests/return_report.json create mode 100644 tests/test_gsxws.py delete mode 100644 tests/update_carryin_repair.json delete mode 100644 tests/update_escalation.json delete mode 100644 tests/update_serial_number.json delete mode 100644 tests/warranty_status.json delete mode 100644 tests/warranty_status.xml diff --git a/gsxws/objectify.py b/gsxws/objectify.py index fd6ceda..3a48858 100644 --- a/gsxws/objectify.py +++ b/gsxws/objectify.py @@ -4,6 +4,7 @@ import os import re import base64 import tempfile + from lxml import objectify, etree from lxml.objectify import StringElement @@ -11,7 +12,8 @@ from datetime import datetime BASE64_TYPES = ('packingList', 'proformaFileData', 'returnLabelFileData',) FLOAT_TYPES = ('totalFromOrder', 'exchangePrice', 'stockPrice', 'netPrice',) -BOOLEAN_TYPES = ('isSerialized', 'popMandatory', 'limitedWarranty', 'partCovered',) +BOOLEAN_TYPES = ('isSerialized', 'popMandatory', 'limitedWarranty', 'partCovered', 'acPlusFlag',) +DATETIME_TYPES = ('dispatchSentDate',) TZMAP = { 'GMT': '', # Greenwich Mean Time @@ -41,6 +43,9 @@ class GsxElement(StringElement): def __str__(self): return unicode(self).encode('utf-8') + def __repr__(self): + return str(self.text) + class GsxDateElement(GsxElement): @property @@ -100,10 +105,8 @@ class GsxTimestampElement(GsxElement): class GsxClassLookup(etree.CustomElementClassLookup): def lookup(self, node_type, document, namespace, name): - if name == 'dispatchSentDate': + if name in DATETIME_TYPES: return GsxDatetimeElement - if name == 'acPlusFlag': - return GsxBooleanElement if name in BOOLEAN_TYPES: return GsxBooleanElement if name in BASE64_TYPES: @@ -117,10 +120,6 @@ class GsxClassLookup(etree.CustomElementClassLookup): def parse(root, response): - """ - >>> parse('../tests/warranty_status.xml', 'warrantyDetailInfo').estimatedPurchaseDate - 2010-08-25 - """ parser = objectify.makeparser(remove_blank_text=True) parser.set_element_class_lookup(GsxClassLookup()) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/acknowledge_communication.json b/tests/acknowledge_communication.json deleted file mode 100644 index 5fd7b9b..0000000 --- a/tests/acknowledge_communication.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "acknowledgement": [ - {"articleID": "SN34", "acknowledgeType": "READ"} - ] -} diff --git a/tests/create_app_order.json b/tests/create_app_order.json deleted file mode 100644 index 1d1bba8..0000000 --- a/tests/create_app_order.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "shipTo": "672592", - "addressLine1": "1277 Jolly Avenue", - "country": "FI", - "zipCode": "00180", - "city": "Sunnyvale", - "state": "ZZ", - "firstName": "Test", - "lastName": "Apple", - "primaryPhone": "2086785671", - "emailAddress": "Test@Apple.com", - "productNumber": "8961", - "purchaseOrder": "Order8961", - "requestPart": { - "serialNumber": "" - }, - "pocLanguage": "FIN" -} diff --git a/tests/create_carryin_repair.json b/tests/create_carryin_repair.json deleted file mode 100644 index 059ad93..0000000 --- a/tests/create_carryin_repair.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "shipTo": "677592", - "serialNumber": "C3TFJJTNDCP9", - "symptom": "Does not work", - "diagnosis": "Does not work", - "unitReceivedDate": "03/01/13", - "unitReceivedTime": "12:00 AM", - "checkIfOutOfWarrantyCoverage": "Y", - "overrideDiagnosticCodeCheck": "Y", - "poNumber": "Order12341", - "orderLines": [ - { - "partNumber": "FD661-6136", - "comptiaCode": "T03", - "comptiaModifier": "B", - "abused": "Y", - "outOfWarrantyFlag": "N", - "diagnosticCode": "" - }, - { - "partNumber": "076-1080", - "comptiaCode": "660", - "comptiaModifier": "A", - "abused": "Y", - "outOfWarrantyFlag": "N", - "diagnosticCode": "" - } - ], - "customerAddress": { - "addressLine1": "Address line 1", - "country": "FI", - "zipCode": "95014", - "regionCode": "005", - "city": "Cupertino", - "state": "ZZ", - "street": "Valley Green Dr", - "firstName": "First", - "lastName": "Last", - "companyName": "Apple Inc", - "primaryPhone": "4088887766", - "emailAddress": "abc@test.com" - } -} diff --git a/tests/create_cnd_repair.json b/tests/create_cnd_repair.json deleted file mode 100644 index c46d8c1..0000000 --- a/tests/create_cnd_repair.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "shipTo": "677592", - "customerAddress": { - "addressLine1": "1277 Henderson Avenue", - "city": "Helsinki", - "country": "FI", - "firstName": "test", - "lastName": "Apple", - "primaryPhone": "2085673498", - "region": "004", - "state": "ZZ", - "zipCode": "00180", - "emailAddress": "test@Apple.com" - }, - "notes": "This is a test note", - "symptom": "This is atest symptom", - "serialNumber": "", - "unitReceivedDate": "10/01/12", - "unitReceivedTime": "12:00 AM", - "classification": "N01" -} diff --git a/tests/create_escalation.json b/tests/create_escalation.json deleted file mode 100644 index 3e1ac9c..0000000 --- a/tests/create_escalation.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "shipTo": "677592", - "issueTypeCode": "PUR", - "notes": "This is a test", - "escalationContext": { - "contextType": "", "contextID": "" - }, - "attachment": [ - {"fileName": "", "fileData": ""} - ] -} diff --git a/tests/create_srf_order.json b/tests/create_srf_order.json deleted file mode 100644 index 7a58344..0000000 --- a/tests/create_srf_order.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "shipToCode": "677592", - "purchaseOrderNumber": "Order12345", - "serialNumber": "", - "reasonForOrder": "SR7", - "orderLines": [ - {"partNumber": "034-4498", "quantity": "1"} - ] -} diff --git a/tests/create_stocking_order.json b/tests/create_stocking_order.json deleted file mode 100644 index 1af23a4..0000000 --- a/tests/create_stocking_order.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "purchaseOrderNumber": "Order7899", - "shipToCode": "677592", - "orderLines": [ - {"partNumber": "661-5097", "quantity": "1"}, - {"partNumber": "661-5098", "quantity": "2"} - ] -} diff --git a/tests/create_whole_unit_exchange.json b/tests/create_whole_unit_exchange.json deleted file mode 100644 index b7e77e2..0000000 --- a/tests/create_whole_unit_exchange.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "billTo": "", - "customerAddress": "", - "diagnosedByTechId": "", - "diagnosis": "", - "fileName": "", - "fileData": "", - "imeiNumber": "", - "requestReviewByApple": "", - "serialNumber": "", - "notes": "", - "orderLines": [ - { - "partNumber": "", - "comptiaCode": "", - "comptiaModifier": "", - "outOfWarrantyFlag": "", - "coveredByACPlus": "", - "diagnosticCode": "" - } - ], - "poNumber": "", - "popFaxed": "", - "referenceNumber": "", - "shipTo": "", - "shipBox": "", - "shipUnitToCustomer": "", - "symptom": "", - "unitReceivedDate": "", - "unitReceivedTime": "", - "notaFiscalNumber": "" -} diff --git a/tests/fetch_communication_articles.json b/tests/fetch_communication_articles.json deleted file mode 100644 index d5a0674..0000000 --- a/tests/fetch_communication_articles.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "priority": "HIGH", - "fromDate": "", - "toDate": "", - "readStatus": "", - "productModel": {} -} diff --git a/tests/fetch_communication_content.json b/tests/fetch_communication_content.json deleted file mode 100644 index cb28cb2..0000000 --- a/tests/fetch_communication_content.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "articleID": "SN234", - "languageCode": "en" -} diff --git a/tests/fetch_ios_activation.json b/tests/fetch_ios_activation.json deleted file mode 100644 index 4b73647..0000000 --- a/tests/fetch_ios_activation.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "serialNumber": "88028ELHA4S" -} diff --git a/tests/fixtures/acknowledge_communication.json b/tests/fixtures/acknowledge_communication.json new file mode 100644 index 0000000..5fd7b9b --- /dev/null +++ b/tests/fixtures/acknowledge_communication.json @@ -0,0 +1,5 @@ +{ + "acknowledgement": [ + {"articleID": "SN34", "acknowledgeType": "READ"} + ] +} diff --git a/tests/fixtures/create_app_order.json b/tests/fixtures/create_app_order.json new file mode 100644 index 0000000..1d1bba8 --- /dev/null +++ b/tests/fixtures/create_app_order.json @@ -0,0 +1,18 @@ +{ + "shipTo": "672592", + "addressLine1": "1277 Jolly Avenue", + "country": "FI", + "zipCode": "00180", + "city": "Sunnyvale", + "state": "ZZ", + "firstName": "Test", + "lastName": "Apple", + "primaryPhone": "2086785671", + "emailAddress": "Test@Apple.com", + "productNumber": "8961", + "purchaseOrder": "Order8961", + "requestPart": { + "serialNumber": "" + }, + "pocLanguage": "FIN" +} diff --git a/tests/fixtures/create_carryin_repair.json b/tests/fixtures/create_carryin_repair.json new file mode 100644 index 0000000..059ad93 --- /dev/null +++ b/tests/fixtures/create_carryin_repair.json @@ -0,0 +1,43 @@ +{ + "shipTo": "677592", + "serialNumber": "C3TFJJTNDCP9", + "symptom": "Does not work", + "diagnosis": "Does not work", + "unitReceivedDate": "03/01/13", + "unitReceivedTime": "12:00 AM", + "checkIfOutOfWarrantyCoverage": "Y", + "overrideDiagnosticCodeCheck": "Y", + "poNumber": "Order12341", + "orderLines": [ + { + "partNumber": "FD661-6136", + "comptiaCode": "T03", + "comptiaModifier": "B", + "abused": "Y", + "outOfWarrantyFlag": "N", + "diagnosticCode": "" + }, + { + "partNumber": "076-1080", + "comptiaCode": "660", + "comptiaModifier": "A", + "abused": "Y", + "outOfWarrantyFlag": "N", + "diagnosticCode": "" + } + ], + "customerAddress": { + "addressLine1": "Address line 1", + "country": "FI", + "zipCode": "95014", + "regionCode": "005", + "city": "Cupertino", + "state": "ZZ", + "street": "Valley Green Dr", + "firstName": "First", + "lastName": "Last", + "companyName": "Apple Inc", + "primaryPhone": "4088887766", + "emailAddress": "abc@test.com" + } +} diff --git a/tests/fixtures/create_cnd_repair.json b/tests/fixtures/create_cnd_repair.json new file mode 100644 index 0000000..c46d8c1 --- /dev/null +++ b/tests/fixtures/create_cnd_repair.json @@ -0,0 +1,21 @@ +{ + "shipTo": "677592", + "customerAddress": { + "addressLine1": "1277 Henderson Avenue", + "city": "Helsinki", + "country": "FI", + "firstName": "test", + "lastName": "Apple", + "primaryPhone": "2085673498", + "region": "004", + "state": "ZZ", + "zipCode": "00180", + "emailAddress": "test@Apple.com" + }, + "notes": "This is a test note", + "symptom": "This is atest symptom", + "serialNumber": "", + "unitReceivedDate": "10/01/12", + "unitReceivedTime": "12:00 AM", + "classification": "N01" +} diff --git a/tests/fixtures/create_escalation.json b/tests/fixtures/create_escalation.json new file mode 100644 index 0000000..3e1ac9c --- /dev/null +++ b/tests/fixtures/create_escalation.json @@ -0,0 +1,11 @@ +{ + "shipTo": "677592", + "issueTypeCode": "PUR", + "notes": "This is a test", + "escalationContext": { + "contextType": "", "contextID": "" + }, + "attachment": [ + {"fileName": "", "fileData": ""} + ] +} diff --git a/tests/fixtures/create_srf_order.json b/tests/fixtures/create_srf_order.json new file mode 100644 index 0000000..7a58344 --- /dev/null +++ b/tests/fixtures/create_srf_order.json @@ -0,0 +1,9 @@ +{ + "shipToCode": "677592", + "purchaseOrderNumber": "Order12345", + "serialNumber": "", + "reasonForOrder": "SR7", + "orderLines": [ + {"partNumber": "034-4498", "quantity": "1"} + ] +} diff --git a/tests/fixtures/create_stocking_order.json b/tests/fixtures/create_stocking_order.json new file mode 100644 index 0000000..1af23a4 --- /dev/null +++ b/tests/fixtures/create_stocking_order.json @@ -0,0 +1,8 @@ +{ + "purchaseOrderNumber": "Order7899", + "shipToCode": "677592", + "orderLines": [ + {"partNumber": "661-5097", "quantity": "1"}, + {"partNumber": "661-5098", "quantity": "2"} + ] +} diff --git a/tests/fixtures/create_whole_unit_exchange.json b/tests/fixtures/create_whole_unit_exchange.json new file mode 100644 index 0000000..b7e77e2 --- /dev/null +++ b/tests/fixtures/create_whole_unit_exchange.json @@ -0,0 +1,32 @@ +{ + "billTo": "", + "customerAddress": "", + "diagnosedByTechId": "", + "diagnosis": "", + "fileName": "", + "fileData": "", + "imeiNumber": "", + "requestReviewByApple": "", + "serialNumber": "", + "notes": "", + "orderLines": [ + { + "partNumber": "", + "comptiaCode": "", + "comptiaModifier": "", + "outOfWarrantyFlag": "", + "coveredByACPlus": "", + "diagnosticCode": "" + } + ], + "poNumber": "", + "popFaxed": "", + "referenceNumber": "", + "shipTo": "", + "shipBox": "", + "shipUnitToCustomer": "", + "symptom": "", + "unitReceivedDate": "", + "unitReceivedTime": "", + "notaFiscalNumber": "" +} diff --git a/tests/fixtures/fetch_communication_articles.json b/tests/fixtures/fetch_communication_articles.json new file mode 100644 index 0000000..d5a0674 --- /dev/null +++ b/tests/fixtures/fetch_communication_articles.json @@ -0,0 +1,7 @@ +{ + "priority": "HIGH", + "fromDate": "", + "toDate": "", + "readStatus": "", + "productModel": {} +} diff --git a/tests/fixtures/fetch_communication_content.json b/tests/fixtures/fetch_communication_content.json new file mode 100644 index 0000000..cb28cb2 --- /dev/null +++ b/tests/fixtures/fetch_communication_content.json @@ -0,0 +1,4 @@ +{ + "articleID": "SN234", + "languageCode": "en" +} diff --git a/tests/fixtures/fetch_ios_activation.json b/tests/fixtures/fetch_ios_activation.json new file mode 100644 index 0000000..4b73647 --- /dev/null +++ b/tests/fixtures/fetch_ios_activation.json @@ -0,0 +1,3 @@ +{ + "serialNumber": "88028ELHA4S" +} diff --git a/tests/fixtures/parts_lookup.json b/tests/fixtures/parts_lookup.json new file mode 100644 index 0000000..b271e16 --- /dev/null +++ b/tests/fixtures/parts_lookup.json @@ -0,0 +1,3 @@ +{ + "partNumber": "661-5732" +} diff --git a/tests/fixtures/parts_pending_return.json b/tests/fixtures/parts_pending_return.json new file mode 100644 index 0000000..91e8ad2 --- /dev/null +++ b/tests/fixtures/parts_pending_return.json @@ -0,0 +1,3 @@ +{ + "repairType": "CA" +} diff --git a/tests/fixtures/parts_register_return.json b/tests/fixtures/parts_register_return.json new file mode 100644 index 0000000..c8a49ae --- /dev/null +++ b/tests/fixtures/parts_register_return.json @@ -0,0 +1,15 @@ +{ + "shipToCode": "", + "carrierCode": "XYZ", + "trackingNumber": "XYZ", + "length": "1", + "width": "1", + "height": "1", + "notes": "test", + "estimatedTotalWeight": "1", + "bulkReturnOrder": { + "boxNumber": "", + "partNumber": "661-5465", + "returnOrderNumber": "7443056106" + } +} diff --git a/tests/fixtures/parts_return_update.json b/tests/fixtures/parts_return_update.json new file mode 100644 index 0000000..5cdefee --- /dev/null +++ b/tests/fixtures/parts_return_update.json @@ -0,0 +1,12 @@ +{ + "repairConfirmationNumber": "G135764009", + "notes": "", + "orderLines": [ + {"partNumber": "661-6529"}, + {"comptiaCode": "N01"}, + {"comptiaModifier": "A"}, + {"orderNumber": "11223344"}, + {"returnOrderNumber": ""}, + {"returnType": "1"} + ] +} diff --git a/tests/fixtures/pending_app_orders.json b/tests/fixtures/pending_app_orders.json new file mode 100644 index 0000000..ec49768 --- /dev/null +++ b/tests/fixtures/pending_app_orders.json @@ -0,0 +1,4 @@ +{ + "startDate": "01/01/12", + "endDate": "10/02/12" +} diff --git a/tests/fixtures/register_bulk_return.json b/tests/fixtures/register_bulk_return.json new file mode 100644 index 0000000..3b6bda8 --- /dev/null +++ b/tests/fixtures/register_bulk_return.json @@ -0,0 +1,13 @@ +{ + "shipToCode": "", + "carrierCode": "XUPSN", + "trackingNumber": "12341234", + "length": "10", + "width": "10", + "height": "10", + "estimatedTotalWeight": "20", + "notes": "", + "bulkReturnOrder": [ + {"returnOrderNumber": "7444640074", "partNumber": "661-6028", "boxNumber": "1"} + ] +} diff --git a/tests/fixtures/repair_lookup.json b/tests/fixtures/repair_lookup.json new file mode 100644 index 0000000..12f35a6 --- /dev/null +++ b/tests/fixtures/repair_lookup.json @@ -0,0 +1,19 @@ +{ + "repairConfirmationNumber": "", + "customerEmailAddress": "", + "customerFirstName": "", + "customerLastName": "", + "fromDate": "", + "toDate": "", + "incompleteRepair": "", + "pendingShipment": "", + "purchaseOrderNumber": "", + "repairNumber": "", + "repairStatus": "", + "repairType": "", + "serialNumber": "W874939YX92", + "shipToCode": "", + "technicianFirstName": "", + "technicianLastName": "", + "unreceivedModules": "" +} diff --git a/tests/fixtures/return_label.json b/tests/fixtures/return_label.json new file mode 100644 index 0000000..edebf48 --- /dev/null +++ b/tests/fixtures/return_label.json @@ -0,0 +1,4 @@ +{ + "returnOrderNumber": "7438971408", + "partNumber": "NF661-5769" +} diff --git a/tests/fixtures/return_report.json b/tests/fixtures/return_report.json new file mode 100644 index 0000000..a868dd3 --- /dev/null +++ b/tests/fixtures/return_report.json @@ -0,0 +1,4 @@ +{ + "shipTo": "", + "warrantyType": "IW" +} diff --git a/tests/fixtures/update_carryin_repair.json b/tests/fixtures/update_carryin_repair.json new file mode 100644 index 0000000..90ee39e --- /dev/null +++ b/tests/fixtures/update_carryin_repair.json @@ -0,0 +1,13 @@ +{ + "repairConfirmationNumber": "G135773004", + "statusCode": "BEGR", + "technicianId": "", + "notes": "", + "orderLines": [ + { + "partNumber": "661-5594", + "comptiaCode": "F1A", + "comptiaModifier": "B" + } + ] +} diff --git a/tests/fixtures/update_escalation.json b/tests/fixtures/update_escalation.json new file mode 100644 index 0000000..cd46995 --- /dev/null +++ b/tests/fixtures/update_escalation.json @@ -0,0 +1,8 @@ +{ + "escalationId": "1440972", + "notes": "This is an update", + "status": "C", + "attachment": [ + {"fileName": "", "fileData": ""} + ] +} diff --git a/tests/fixtures/update_serial_number.json b/tests/fixtures/update_serial_number.json new file mode 100644 index 0000000..789bdf6 --- /dev/null +++ b/tests/fixtures/update_serial_number.json @@ -0,0 +1,12 @@ +{ + "repairConfirmationNumber": "G135762375", + "partInfo": [ + { + "partNumber": "661-4964", + "oldSerialNumber": "W882300FK22YA", + "serialNumber": "W8829012R22XA", + "reasonCode": "", + "isPartDOA": "N" + } + ] +} diff --git a/tests/fixtures/warranty_status.json b/tests/fixtures/warranty_status.json new file mode 100644 index 0000000..9d02027 --- /dev/null +++ b/tests/fixtures/warranty_status.json @@ -0,0 +1,3 @@ +{ + "serialNumber": "" +} diff --git a/tests/fixtures/warranty_status.xml b/tests/fixtures/warranty_status.xml new file mode 100644 index 0000000..9712590 --- /dev/null +++ b/tests/fixtures/warranty_status.xml @@ -0,0 +1,40 @@ + + + + + + 5fdef1309390619199 + + 70033CDFA4S + Apple Limited Warranty + 08/24/11 + 08/25/10 + 0 + 08/25/10 + + United States + 08/25/10 + http://service.info.apple.com/parts/service_parts/products/iphone4.jpg + http://service.info.apple.com/parts/service_parts/ev/iphone4.ev.pdf + http://download.info.apple.com/Apple_Support_Area/Misc/Service/servicemanuals/ + iPhone 4 + IPHONE 4,16GB BLACK + + + + + + + + Y + Y + Y + + + Y + + + + + + diff --git a/tests/parts_lookup.json b/tests/parts_lookup.json deleted file mode 100644 index b271e16..0000000 --- a/tests/parts_lookup.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "partNumber": "661-5732" -} diff --git a/tests/parts_pending_return.json b/tests/parts_pending_return.json deleted file mode 100644 index 91e8ad2..0000000 --- a/tests/parts_pending_return.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "repairType": "CA" -} diff --git a/tests/parts_register_return.json b/tests/parts_register_return.json deleted file mode 100644 index c8a49ae..0000000 --- a/tests/parts_register_return.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "shipToCode": "", - "carrierCode": "XYZ", - "trackingNumber": "XYZ", - "length": "1", - "width": "1", - "height": "1", - "notes": "test", - "estimatedTotalWeight": "1", - "bulkReturnOrder": { - "boxNumber": "", - "partNumber": "661-5465", - "returnOrderNumber": "7443056106" - } -} diff --git a/tests/parts_return_update.json b/tests/parts_return_update.json deleted file mode 100644 index 5cdefee..0000000 --- a/tests/parts_return_update.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "repairConfirmationNumber": "G135764009", - "notes": "", - "orderLines": [ - {"partNumber": "661-6529"}, - {"comptiaCode": "N01"}, - {"comptiaModifier": "A"}, - {"orderNumber": "11223344"}, - {"returnOrderNumber": ""}, - {"returnType": "1"} - ] -} diff --git a/tests/pending_app_orders.json b/tests/pending_app_orders.json deleted file mode 100644 index ec49768..0000000 --- a/tests/pending_app_orders.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "startDate": "01/01/12", - "endDate": "10/02/12" -} diff --git a/tests/register_bulk_return.json b/tests/register_bulk_return.json deleted file mode 100644 index 3b6bda8..0000000 --- a/tests/register_bulk_return.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "shipToCode": "", - "carrierCode": "XUPSN", - "trackingNumber": "12341234", - "length": "10", - "width": "10", - "height": "10", - "estimatedTotalWeight": "20", - "notes": "", - "bulkReturnOrder": [ - {"returnOrderNumber": "7444640074", "partNumber": "661-6028", "boxNumber": "1"} - ] -} diff --git a/tests/repair_lookup.json b/tests/repair_lookup.json deleted file mode 100644 index 12f35a6..0000000 --- a/tests/repair_lookup.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "repairConfirmationNumber": "", - "customerEmailAddress": "", - "customerFirstName": "", - "customerLastName": "", - "fromDate": "", - "toDate": "", - "incompleteRepair": "", - "pendingShipment": "", - "purchaseOrderNumber": "", - "repairNumber": "", - "repairStatus": "", - "repairType": "", - "serialNumber": "W874939YX92", - "shipToCode": "", - "technicianFirstName": "", - "technicianLastName": "", - "unreceivedModules": "" -} diff --git a/tests/return_label.json b/tests/return_label.json deleted file mode 100644 index edebf48..0000000 --- a/tests/return_label.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "returnOrderNumber": "7438971408", - "partNumber": "NF661-5769" -} diff --git a/tests/return_report.json b/tests/return_report.json deleted file mode 100644 index a868dd3..0000000 --- a/tests/return_report.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "shipTo": "", - "warrantyType": "IW" -} diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py new file mode 100644 index 0000000..d7feac6 --- /dev/null +++ b/tests/test_gsxws.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +import unittest +from datetime import date + +from gsxws.objectify import parse + + +class TestWarrantyFunctions(unittest.TestCase): + def setUp(self): + self.wty = parse('tests/fixtures/warranty_status.xml', 'warrantyDetailInfo') + + def test_purchase_date(self): + self.assertIsInstance(self.wty.estimatedPurchaseDate.pyval, date) + + def test_config_description(self): + self.assertEqual(self.wty.configDescription, 'IPHONE 4,16GB BLACK') + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/update_carryin_repair.json b/tests/update_carryin_repair.json deleted file mode 100644 index 90ee39e..0000000 --- a/tests/update_carryin_repair.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "repairConfirmationNumber": "G135773004", - "statusCode": "BEGR", - "technicianId": "", - "notes": "", - "orderLines": [ - { - "partNumber": "661-5594", - "comptiaCode": "F1A", - "comptiaModifier": "B" - } - ] -} diff --git a/tests/update_escalation.json b/tests/update_escalation.json deleted file mode 100644 index cd46995..0000000 --- a/tests/update_escalation.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "escalationId": "1440972", - "notes": "This is an update", - "status": "C", - "attachment": [ - {"fileName": "", "fileData": ""} - ] -} diff --git a/tests/update_serial_number.json b/tests/update_serial_number.json deleted file mode 100644 index 789bdf6..0000000 --- a/tests/update_serial_number.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "repairConfirmationNumber": "G135762375", - "partInfo": [ - { - "partNumber": "661-4964", - "oldSerialNumber": "W882300FK22YA", - "serialNumber": "W8829012R22XA", - "reasonCode": "", - "isPartDOA": "N" - } - ] -} diff --git a/tests/warranty_status.json b/tests/warranty_status.json deleted file mode 100644 index 9d02027..0000000 --- a/tests/warranty_status.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "serialNumber": "" -} diff --git a/tests/warranty_status.xml b/tests/warranty_status.xml deleted file mode 100644 index 9712590..0000000 --- a/tests/warranty_status.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - 5fdef1309390619199 - - 70033CDFA4S - Apple Limited Warranty - 08/24/11 - 08/25/10 - 0 - 08/25/10 - - United States - 08/25/10 - http://service.info.apple.com/parts/service_parts/products/iphone4.jpg - http://service.info.apple.com/parts/service_parts/ev/iphone4.ev.pdf - http://download.info.apple.com/Apple_Support_Area/Misc/Service/servicemanuals/ - iPhone 4 - IPHONE 4,16GB BLACK - - - - - - - - Y - Y - Y - - - Y - - - - - - -- cgit v1.2.3