aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2014-09-03 21:28:25 +0300
committerFilipp Lepalaan <filipp@mac.com>2014-09-03 21:28:25 +0300
commitf6e478954c8781395828bf24ccab2a95e0cfe1df (patch)
tree46ca2fad4dc79d2f11199e22822ea9f28d22f73d
parentbbd0612d793e19cd76253e6466ff95a5426386d2 (diff)
downloadpy-gsxws-f6e478954c8781395828bf24ccab2a95e0cfe1df.tar.gz
py-gsxws-f6e478954c8781395828bf24ccab2a95e0cfe1df.tar.bz2
py-gsxws-f6e478954c8781395828bf24ccab2a95e0cfe1df.zip
Added iOS diagnostics initiation
-rw-r--r--gsxws/diagnostics.py14
-rw-r--r--gsxws/products.yaml2
-rw-r--r--tests/test_gsxws.py19
3 files changed, 32 insertions, 3 deletions
diff --git a/gsxws/diagnostics.py b/gsxws/diagnostics.py
index 5131432..eadb874 100644
--- a/gsxws/diagnostics.py
+++ b/gsxws/diagnostics.py
@@ -1,11 +1,23 @@
# -*- coding: utf-8 -*-
-from core import GsxObject
+from core import GsxObject, GsxError
class Diagnostics(GsxObject):
_namespace = "glob:"
+ def initiate(self):
+ """
+ The Initiate iOS Diagnostic API allows users to initiate Diagnostic Request for iOS Device.
+ Then it sends the diagnostic URL (diags://<Ticket Number >) as an email or SMS
+ to the email address or phone number based on the information provided in the request.
+ The ticket is generated within GSX system.
+ """
+ self._submit("initiateRequestData", "InitiateIOSDiagnostic",
+ "initiateResponseData")
+
+ return self._req.objects.ticketNumber
+
def fetch(self):
"""
The Fetch Repair Diagnostics API allows the service providers/depot/carriers
diff --git a/gsxws/products.yaml b/gsxws/products.yaml
index c46bcfc..2c0d68d 100644
--- a/gsxws/products.yaml
+++ b/gsxws/products.yaml
@@ -16,7 +16,7 @@ DISPLAYS:
- "Cinema Display (30-inch DVI Early 2007)"
- "LED Cinema Display (24-inch)"
- "LED Cinema Display (27-inch)"
- - "Thunderbolt Display (27-inch)"
+ - "Apple Thunderbolt Display (27-inch)"
IMAC:
name: iMac
diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py
index 1de1906..dc0f4aa 100644
--- a/tests/test_gsxws.py
+++ b/tests/test_gsxws.py
@@ -9,7 +9,7 @@ from unittest import main, skip, TestCase
from gsxws.objectify import parse, gsx_diags_timestamp
from gsxws.products import Product
from gsxws import (repairs, escalations, lookups,
- GsxError, ServicePart, diagnostics)
+ GsxError, ServicePart, diagnostics,)
class RemoteTestCase(TestCase):
@@ -21,6 +21,23 @@ class RemoteTestCase(TestCase):
env['GSX_ENV'])
+class DiagnosticsTestCase(RemoteTestCase):
+ def setUp(self):
+ super(DiagnosticsTestCase, self).setUp()
+ self.diag = diagnostics.Diagnostics(serialNumber=env['GSX_SN'])
+ self.diag.shipTo = env['GSX_SHIPTO']
+
+ def test_initiate_email(self):
+ self.diag.emailAddress = env['GSX_EMAIL']
+ res = self.diag.initiate()
+ self.assertRegexpMatches(str(res), r'\d+')
+
+ def test_initiate_phone(self):
+ self.diag.phoneNumber = env['GSX_PHONE']
+ with self.assertRaisesRegexp(GsxError, 'SMS sending is not supported'):
+ self.diag.initiate()
+
+
class RepairTestCase(RemoteTestCase):
def setUp(self):
super(RepairTestCase, self).setUp()