From d0926571dc2b5305d4fa75a489f64435f962b346 Mon Sep 17 00:00:00 2001 From: lakshani Date: Tue, 7 Feb 2017 23:54:24 +0530 Subject: [PATCH] added test cases for chage device status --- .../java/org/wso2/iot/integration/common/Constants.java | 5 ++++- .../integration/mobileDevice/MobileDeviceManagement.java | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java index d80a0042..03e58241 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/common/Constants.java @@ -46,6 +46,7 @@ public final class Constants { public static final String UTF8 = "UTF-8"; public static final String ZERO = "0"; public static final String NULL = "[]"; + public static final String INACTIVE = "INACTIVE"; public static final String HTTPS = "https"; public static final String HTTP = "http"; @@ -91,7 +92,8 @@ public final class Constants { + "perm:roles:create-combined-role perm:roles:delete perm:roles:details perm:roles:permissions " + "perm:roles:update perm:roles:view perm:users:add perm:users:count perm:users:credentials " + "perm:users:delete perm:users:details perm:users:is-exist perm:users:roles perm:users:search " - + "perm:users:send-invitation perm:users:update perm:users:user-details perm:view-configuration"; + + "perm:users:send-invitation perm:users:update perm:users:user-details perm:view-configuration " + + "perm:devices:change-status"; private APIApplicationRegistration() { throw new AssertionError(); @@ -294,6 +296,7 @@ public final class Constants { public static final class MobileDeviceManagement { public static final String MOBILE_DEVICE_MANAGEMENT_GROUP = "mobile-device-mgt"; public static final String GET_DEVICE_COUNT_ENDPOINT = "/api/device-mgt/v1.0/devices"; + public static final String CHANGE_DEVICE_STATUS_ENDPOINT = "/api/device-mgt/v1.0/devices/"; public static final String NO_OF_DEVICES = "1"; public static final String GET_ALL_DEVICES_ENDPOINT = "/mdm-admin/devices"; public static final String VIEW_DEVICE_TYPES_ENDPOINT = "/mdm-admin/devices/types"; diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagement.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagement.java index 9f9db680..f68daca4 100644 --- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagement.java +++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/mobileDevice/MobileDeviceManagement.java @@ -73,4 +73,11 @@ public class MobileDeviceManagement extends TestBase { //Response has two device types, because in windows enrollment a windows device is previously enrolled. } + @Test(description = "Change device status") + public void testRemoveDevices() throws Exception { + String endpointUrl = Constants.MobileDeviceManagement.CHANGE_DEVICE_STATUS_ENDPOINT + Constants.ANDROID_DEVICE_TYPE + + "/" + Constants.DEVICE_ID + "/changestatus?newStatus=" + Constants.INACTIVE; + IOTResponse response = client.put(endpointUrl, ""); + Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); + } }