aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-09-29 00:05:36 +0300
committerFilipp Lepalaan <filipp@mac.com>2015-09-29 00:05:36 +0300
commit9d860f29579bc3764ccb9e34f8ae7d51cfc3ea09 (patch)
treee86563e77295befe0ffcc17cd408d31a6703c6f8
parent8eab047c3e7be7960897b692ef28729dee53fe7a (diff)
downloadpy-gsxws-9d860f29579bc3764ccb9e34f8ae7d51cfc3ea09.tar.gz
py-gsxws-9d860f29579bc3764ccb9e34f8ae7d51cfc3ea09.tar.bz2
py-gsxws-9d860f29579bc3764ccb9e34f8ae7d51cfc3ea09.zip
Fixed FetchDiagnosticDetails
-rw-r--r--gsxws/core.py10
-rw-r--r--tests/test_gsxws.py8
2 files changed, 12 insertions, 6 deletions
diff --git a/gsxws/core.py b/gsxws/core.py
index 9ebe1bf..0beed92 100644
--- a/gsxws/core.py
+++ b/gsxws/core.py
@@ -292,7 +292,7 @@ class GsxRequest(object):
# Send GSX client certs with every request
try:
self.gsx_cert = os.environ['GSX_CERT']
- self.gsx_key = os.environ['GSX_KEY']
+ self.gsx_key = os.environ['GSX_KEY']
except KeyError as e:
raise GsxError('SSL configuration error: %s' % e)
@@ -316,6 +316,10 @@ class GsxRequest(object):
# @hack for Reported Symptom/Issue API which nests two ReportedSymptomIssueRequest elements
if method.endswith("Request"):
request_name = method
+
+ # @hack FetchDiagnosticDetails doesn't follow the naming conventions
+ if method.endswith('FetchDiagnosticDetails'):
+ request_name = 'FetchDiagnosticDetailsRequestData'
request = ET.SubElement(root, request_name)
request.append(GSX_SESSION)
@@ -327,8 +331,8 @@ class GsxRequest(object):
request.append(self.data)
data = ET.tostring(self.env, "UTF-8")
- res = self._send(method, data)
- xml = res.text.encode('utf-8')
+ res = self._send(method, data)
+ xml = res.text.encode('utf-8')
self.xml_response = xml
if res.status_code > 200:
diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py
index e18cbe0..593b8ca 100644
--- a/tests/test_gsxws.py
+++ b/tests/test_gsxws.py
@@ -44,14 +44,16 @@ class ComptiaTestCase(RemoteTestCase):
self.assertIsInstance(data['E'], dict)
-class DiagnosticsTestCase(RemoteTestCase):
+class DiagnosticsTestCase(TestCase):
def setUp(self):
- super(DiagnosticsTestCase, self).setUp()
+ from gsxws.core import connect
+ connect(os.getenv('GSX_USER'), os.getenv('GSX_SOLDTO'), os.getenv('GSX_ENV'))
+ self.sn = os.getenv('GSX_SN')
+ device = Product(sn=self.sn)
self.diag = diagnostics.Diagnostics(serialNumber=self.sn)
self.diag.shipTo = os.getenv('GSX_SHIPTO')
def test_fetch(self):
- self.diag = diagnostics.Diagnostics(alternateDeviceId=self.sn)
res = self.diag.fetch()
for r in res.diagnosticTestData.testResult.result: