From 5652c5955593b1118f8b3d496c84fba4f164129c Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 13 May 2014 23:00:58 +0300 Subject: Added some iOS diags tests --- gsxws/diagnostics.py | 9 +- tests/fixtures/ios_diagnostics.xml | 240 +++++++++++++++++++++++++++++++++++++ tests/test_gsxws.py | 34 +++++- 3 files changed, 279 insertions(+), 4 deletions(-) create mode 100644 tests/fixtures/ios_diagnostics.xml diff --git a/gsxws/diagnostics.py b/gsxws/diagnostics.py index f9f9d7d..5131432 100644 --- a/gsxws/diagnostics.py +++ b/gsxws/diagnostics.py @@ -16,9 +16,11 @@ class Diagnostics(GsxObject): >>> Diagnostics(diagnosticEventNumber='12942008007242012052919').fetch() """ if hasattr(self, "alternateDeviceId"): - self._submit("lookupRequestData", "FetchIOSDiagnostic", "lookupResponseData") + self._submit("lookupRequestData", "FetchIOSDiagnostic", + "lookupResponseData") else: - self._submit("lookupRequestData", "FetchRepairDiagnostic", "FetchRepairDiagnosticResponse") + self._submit("lookupRequestData", "FetchRepairDiagnostic", + "FetchRepairDiagnosticResponse") return self._req.objects @@ -28,5 +30,6 @@ class Diagnostics(GsxObject): diagnostic event numbers associated with provided input (serial number or alternate device ID). """ - self._submit("lookupRequestData", "FetchDiagnosticEventNumbers", "diagnosticEventNumbers") + self._submit("lookupRequestData", "FetchDiagnosticEventNumbers", + "diagnosticEventNumbers") return self._req.objects diff --git a/tests/fixtures/ios_diagnostics.xml b/tests/fixtures/ios_diagnostics.xml new file mode 100644 index 0000000..0a67091 --- /dev/null +++ b/tests/fixtures/ios_diagnostics.xml @@ -0,0 +1,240 @@ + + + + + + 4fmhx3nKL7MAnvoq6SGM0Bc + + + + XXXXXXXXXXXX + 64419571 + 13-May-14 18:34:52 + GSX + 0 + R3.001 + 36558205 + + + + BATTERY_HEALTH + 1 + GREEN + + + FULLY_CHARGED + 1 + + + + LATEST_IOS_VERSION + 1 + + + + UNCLEAN_SHUTDOWN_TEST + 1 + + + + + + + + + SERIAL_NUM + XXXXXXXXXXXX + + + DEVICE_NAME + fliPhone + + + HARDWARE_MODEL + iPhone5,2 + + + CURR_IOS_VERSION + 7001001 + + + RESTORE_DATE + 03-Apr-14 08:54:27 + + + LATEST_IOS_VERSION_AVAILABLE + 7001001 + + + + + + + + LAST_USAGE_LENGTH + 44863 + + + LAST_STANDBY_LENGTH + 85031 + + + LAST_USAGE_BATTERY_LEVEL + 83 + + + LONGEST_STANDBY_LENGTH + 312426 + + + LONGEST_STANDBY_DATE + 03-May-14 09:07:41 + + + LONGEST_STANDBY_BATTERY_LEVEL + 8 + + + PLUGGED_IN_AFTER_LAST_USAGE + 0 + + + LONGEST_USAGE_LENGTH + 16378 + + + LONGEST_USAGE_DATE + 03-May-14 09:07:41 + + + LONGEST_USAGE_BATTERY_LEVEL + 8 + + + + + HIGH_TEMP + 0.0 + + + NUM_TEMP_WARN + 0 + + + TOTAL_TIME_WARN + 0 + + + HIGH_TEMP_RESPONSE_CODE + 0 + + + + + FREQ_APP_CRASH + BitTorrent Sync,CommCenterMobileHelper + + + APP_CRASH_RESPONSE_CODE + 1 + + + + + OUT_OF_MEMORY + + + + MOST_OUT_OF_MEMORY_APP + + + + MEMORY_RESPONSE_CODE + 0 + + + + + FREQ_APP_HANG + + + + APP_HANG_COUNT + 0 + + + APP_HANG_RESPONSE_CODE + 0 + + + + + UNCLEAN_SHUTDOWN_COUNT + 0 + + + SPRINGBOARD_UNRESPONSIVE_COUNT + 0 + + + + + THIRD_PARTY_APP_TEST + + + + THIRD_PARTY_APP_RESPONSE_CODE + 0 + + + + + CURR_BATTERY_LEVEL + 83 + + + + + + + + BATTERY_HEALTH + Troubleshooting iPhone Lithium-Ion Batteries + http://www.apple.com/batteries/iphone.html + + + UNCLEAN_SHUTDOWN_TEST + Turning off and on (restarting) and resetting. + http://support.apple.com/kb/HT1430 + + + HIGH_TEMP_RESPONSE_CODE + Keeping device within acceptable operating temperatures. + http://support.apple.com/kb/HT2101 + + + APP_CRASH_RESPONSE_CODE + iOS: Troubleshooting applications purchased from the App Store. Ensure all 3rd Party Apps are updated to the latest version. + http://support.apple.com/kb/TS1702 + + + APP_HANG_RESPONSE_CODE + Understanding multitasking. + http://support.apple.com/kb/HT4211 + + + THIRD_PARTY_APP_RESPONSE_CODE + iOS: Troubleshooting applications purchased from the App Store. + http://support.apple.com/kb/TS1702 + + + MEMORY_RESPONSE_CODE + iOS: Troubleshooting applications purchased from the App Store. + http://support.apple.com/kb/TS1702 + + + There are high priority communications pending for you + + + + \ No newline at end of file diff --git a/tests/test_gsxws.py b/tests/test_gsxws.py index 8ce6328..8f11633 100644 --- a/tests/test_gsxws.py +++ b/tests/test_gsxws.py @@ -212,7 +212,7 @@ class TestWarrantyFunctions(TestCase): self.assertTrue(self.data.partCovered) -class TestDiagnostics(RemoteTestCase): +class TestRepairDiagnostics(RemoteTestCase): def setUp(self): super(TestDiagnostics, self).setUp() self.results = diagnostics.Diagnostics(serialNumber=env['GSX_SN']).fetch() @@ -224,6 +224,38 @@ class TestDiagnostics(RemoteTestCase): ts = gsx_diags_timestamp(self.results.eventHeader.startTimeStamp) self.assertIsInstance(ts, datetime) + +class TestIosDiagnostics(TestCase): + def setUp(self): + self.data = parse('tests/fixtures/ios_diagnostics.xml', + 'lookupResponseData') + + def test_sn(self): + self.assertEqual(self.data.diagnosticTestData.testContext.serialNumber, + "XXXXXXXXXXXX") + + def test_result(self): + data = self.data.diagnosticTestData.testResult + for i in data.result: + logging.debug("%s: %s" % (i.name, i.value)) + + self.assertEqual(data.result[1].name, "FULLY_CHARGED") + + def test_profile(self): + data = self.data.diagnosticProfileData.profile + for i in data.unit.key: + logging.debug("%s: %s" % (i.name, i.value)) + + self.assertEqual(data.unit.key[1].value, "fliPhone") + + def test_report(self): + data = self.data.diagnosticProfileData.report + for i in data.reportData.key: + logging.debug("%s: %s" % (i.name, i.value)) + + self.assertEqual(data.reportData.key[0].name, "LAST_USAGE_LENGTH") + + class TestOnsiteCoverage(RemoteTestCase): def setUp(self): super(TestOnsiteCoverage, self).setUp() -- cgit v1.2.3