@Test( dependsOnMethods = {"testInstallApps"}, description = "Test get operations for device with wrong Device ID") public void testGetDeviceOperationsWithWrongDeviceID() throws Exception { MDMResponse response = client.get( Constants.OperationManagement.GET_DEVICE_OPERATIONS_ENDPOINT + Constants.DEVICE_IMEI); Assert.assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus()); }
@Test( dependsOnMethods = {"testInstallApps"}, description = "Test get device apps with wrong Device ID") public void testGetDeviceAppsWithWrongDeviceID() throws Exception { MDMResponse response = client.get( Constants.OperationManagement.GET_DEVICE_APPS_ENDPOINT + Constants.NUMBER_NOT_EQUAL_TO_DEVICE_ID + Constants.OperationManagement.PATH_APPS); Assert.assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus()); }
@Test(description = "Testing devices-with-details-api with no-db-data") public void testDevicesWithDetailsAPIWithNoDBData() throws Exception { MDMResponse response = client.get(Constants.DashboardAPIChecker.DEVICES_WITH_DETAILS_API_ENDPOINT); org.testng.Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); // checking for correct response with no data Assert.assertTrue( response .getBody() .contains("[{\"context\":\"Filtered-devices-with-details\",\"data\":[]}]")); }
@Test(description = "Testing device-counts-by-groups-api with no-db-data") public void testDeviceCountsByGroupsAPIWithNoDBData() throws Exception { MDMResponse response = client.get(Constants.DashboardAPIChecker.DEVICE_COUNTS_BY_GROUPS_API_ENDPOINT); org.testng.Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); // checking for correct response with no data Assert.assertTrue( response .getBody() .contains( "[{\"context\":\"Device-counts-by-platforms\",\"groupingAttribute\":\"platform\",\"data\":[]}," + "{\"context\":\"Device-counts-by-ownerships\",\"groupingAttribute\":\"ownership\",\"data\":[]}]")); }
@Test(description = "Testing non-compliant-device-counts-by-features-api with no-db-data") public void testNonCompliantDeviceCountsByFeaturesAPIWithNoDBData() throws Exception { MDMResponse response = client.get( Constants.DashboardAPIChecker.NON_COMPLIANT_DEVICE_COUNTS_BY_FEATURES_API_ENDPOINT); org.testng.Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); // checking for correct response with no data Assert.assertTrue( response .getBody() .contains( "[{\"totalRecordCount\":0,\"context\":\"Non-compliant-device-counts-by-features\"," + "\"groupingAttribute\":\"non-compliant-feature-code\",\"data\":[]}]")); }
@Test(description = "Testing filtered-device-count-over-total-api with no-db-data") public void testFilteredDeviceCountOverTotalAPIWithNoDBData() throws Exception { MDMResponse response = client.get(Constants.DashboardAPIChecker.FILTERED_DEVICE_COUNT_OVER_TOTAL_API_ENDPOINT); org.testng.Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); // checking for correct response with no data Assert.assertTrue( response .getBody() .contains( "[{\"context\":\"Filtered-device-count-over-total\"," + "\"data\":[{\"group\":\"filtered\",\"displayNameForGroup\":\"Filtered\",\"deviceCount\":0}," + "{\"group\":\"total\",\"displayNameForGroup\":\"Total\",\"deviceCount\":0}]}]")); }
@Test(description = "Testing device-counts-by-potential-vulnerabilities-api with no-db-data") public void testDeviceCountsByPotentialVulnerabilitiesAPIWithNoDBData() throws Exception { MDMResponse response = client.get( Constants.DashboardAPIChecker.DEVICE_COUNTS_BY_POTENTIAL_VULNERABILITIES_API_ENDPOINT); org.testng.Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); // checking for correct response with no data Assert.assertTrue( response .getBody() .contains( "[{\"context\":\"Device-counts-by-potential-vulnerabilities\",\"groupingAttribute\":" + "\"potential-vulnerability\",\"data\":[{\"group\":\"NON_COMPLIANT\",\"displayNameForGroup\":" + "\"Non-compliant\",\"deviceCount\":0},{\"group\":\"UNMONITORED\",\"displayNameForGroup\":" + "\"Unmonitored\",\"deviceCount\":0}]}]")); }
@Test(description = "Add an Android device.") public void testEnrollment() throws Exception { JsonObject enrollmentData = PayloadGenerator.getJsonPayload( Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST); enrollmentData.addProperty(Constants.DEVICE_IDENTIFIER_KEY, Constants.DEVICE_ID); MDMResponse response = client.post(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT, enrollmentData.toString()); Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); AssertUtil.jsonPayloadCompare( PayloadGenerator.getJsonPayload( Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST) .toString(), response.getBody(), true); }
@Test(description = "Testing device-count-overview-api with no-db-data") public void testDeviceCountOverviewAPIWithNoDBData() throws Exception { MDMResponse response = client.get(Constants.DashboardAPIChecker.DEVICE_COUNT_OVERVIEW_API_ENDPOINT); org.testng.Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); // checking for total device count response with no data Assert.assertTrue( response .getBody() .contains( "{\"context\":\"Total-device-count\",\"data\":[{\"group\":" + "\"total\",\"displayNameForGroup\":\"Total\",\"deviceCount\":0}]}")); // checking for connectivity status response with no data Assert.assertTrue( response .getBody() .contains( "{\"context\":\"Device-counts-by-connectivity-statuses\"," + "\"groupingAttribute\":\"connectivity-status\",\"data\":[]}")); }