From 29b20a4bcea26b604b41d3baa4ab79afc13ac887 Mon Sep 17 00:00:00 2001 From: arvindyadav108 Date: Tue, 3 Jul 2018 11:26:47 +0530 Subject: [PATCH] Issue # SB-5072 Development : User Functional test case fixes. --- .../integration/test/user/EndpointConfig.java | 3 +-- .../sunbird/integration/test/user/UserTest.java | 17 +++-------------- .../create/user_duplicate_email_response.json | 4 ++-- .../create/user_username_exist_response.json | 4 ++-- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/EndpointConfig.java b/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/EndpointConfig.java index dfa92ebd..faf5489b 100644 --- a/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/EndpointConfig.java +++ b/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/EndpointConfig.java @@ -38,8 +38,7 @@ public TestGlobalProperty initGlobalValues() { property.setEsPort(System.getenv("sunbird_es_port")); property.setIndexType(System.getenv("sunbird_es_index_type")); property.setIndex(System.getenv("sunbird_es_index")); - // System.getenv("sunbird_default_channel") - property.setSunbirdDefaultChannel("sunbird-dev"); + property.setSunbirdDefaultChannel(System.getenv("sunbird_default_channel")); property.setLmsUrl(System.getenv("sunbird_test_base_url")); return property; } diff --git a/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/UserTest.java b/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/UserTest.java index 958cf2a2..d72af66d 100644 --- a/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/UserTest.java +++ b/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/UserTest.java @@ -41,6 +41,7 @@ public class UserTest extends TestNGCitrusTestDesigner { private static volatile String USER_NAME = "userName"; private static String externalId = String.valueOf(System.currentTimeMillis()); private static String provider = String.valueOf(System.currentTimeMillis() + 10); + private static TestGlobalProperty testGlobalProperty = new EndpointConfig().initGlobalValues(); /** * User can define the api request and response json structure. first index is request json @@ -93,11 +94,6 @@ public Object[][] createUserDynamicJsonData() { Constant.USER_TEMPLATE_LOCATION + "user_username_exist_response.json", "duplicateUsernameTest" }, - new Object[] { - createUserWithDuplicateExtIdAndProvider(), - Constant.USER_TEMPLATE_LOCATION + "user_already_exist_response.json", - "duplicateExtIdAndProviderTest" - }, new Object[] { createUserWithInvalidChannel(), Constant.USER_TEMPLATE_LOCATION + "invalid_channel_response.json", @@ -110,11 +106,6 @@ public Object[][] createUserDynamicJsonData() { public Object[][] updateUserDataProvider() { return new Object[][] { new Object[] {updateUserWithId(), "update_user_success_response.json", "updateUserWithId"}, - new Object[] { - updateUserWithExtIdAndProvider(), - "update_user_success_response.json", - "updateUserWithExtIdAndProvider" - }, new Object[] { updateUserWithRegOrgId(), Constant.UPDATE_USER_TEMPLATE_LOCATION + "user_update_bad_request_response.json", @@ -408,8 +399,6 @@ private String createUserWithInvalidChannel() { innerMap.put( Constant.EMAIL, Constant.USER_NAME_PREFIX + UUID.randomUUID().toString() + "@gmail.com"); innerMap.put(Constant.USER_NAME, Constant.USER_NAME_PREFIX + UUID.randomUUID().toString()); - innerMap.put(Constant.EXTERNAL_ID, externalId + 123); - innerMap.put(Constant.PROVIDER, provider + 234); innerMap.put(Constant.CHANNEL, "functionalTest#Invalid$Channel@1235123"); requestMap.put(Constant.REQUEST, innerMap); try { @@ -452,8 +441,7 @@ private static Map createUserInnerMap() { innerMap.put(Constant.FIRST_NAME, "ft_first_Name_pw12401"); innerMap.put(Constant.LAST_NAME, "ft_lastName"); innerMap.put(Constant.PASSWORD, "password"); - innerMap.put(Constant.EXTERNAL_ID, externalId); - innerMap.put(Constant.PROVIDER, provider); + innerMap.put(Constant.CHANNEL,testGlobalProperty.getSunbirdDefaultChannel()); USER_NAME = Constant.USER_NAME_PREFIX + EndpointConfig.val; String email = Constant.USER_NAME_PREFIX + EndpointConfig.val + "@gmail.com"; innerMap.put(Constant.USER_NAME, USER_NAME); @@ -468,6 +456,7 @@ private String updateUserWithId() { innerMap.put(Constant.ID, userId); innerMap.put(Constant.USER_ID, userId); innerMap.remove(Constant.USER_NAME); + innerMap.remove(Constant.CHANNEL); requestMap.put(Constant.REQUEST, innerMap); try { diff --git a/sunbird_service_api_test/src/test/resources/templates/user/create/user_duplicate_email_response.json b/sunbird_service_api_test/src/test/resources/templates/user/create/user_duplicate_email_response.json index e062e411..0388fb64 100644 --- a/sunbird_service_api_test/src/test/resources/templates/user/create/user_duplicate_email_response.json +++ b/sunbird_service_api_test/src/test/resources/templates/user/create/user_duplicate_email_response.json @@ -6,8 +6,8 @@ { "resmsgid":null, "msgid":"@ignore@", -"err":"USER_ALREADY_EXISTS", -"status":"USER_ALREADY_EXISTS", +"err":"USERNAME_EMAIL_IN_USE", +"status":"USERNAME_EMAIL_IN_USE", "errmsg":"@ignore@" } ,"responseCode":"CLIENT_ERROR", diff --git a/sunbird_service_api_test/src/test/resources/templates/user/create/user_username_exist_response.json b/sunbird_service_api_test/src/test/resources/templates/user/create/user_username_exist_response.json index e062e411..0388fb64 100644 --- a/sunbird_service_api_test/src/test/resources/templates/user/create/user_username_exist_response.json +++ b/sunbird_service_api_test/src/test/resources/templates/user/create/user_username_exist_response.json @@ -6,8 +6,8 @@ { "resmsgid":null, "msgid":"@ignore@", -"err":"USER_ALREADY_EXISTS", -"status":"USER_ALREADY_EXISTS", +"err":"USERNAME_EMAIL_IN_USE", +"status":"USERNAME_EMAIL_IN_USE", "errmsg":"@ignore@" } ,"responseCode":"CLIENT_ERROR",