def test_updateRole_editBy_with_55Characters_005(): logger = LogGen.loggen() com = Common_role_api() logger.info( "**************** Test_005: Test updateRole when user sends - editBy with 55 characters ****************" ) logger.info( "https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) print( "**************** Test_005: Test updateRole when user sends - editBy with 55 characters ****************" ) print( "Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) url = ReadConfig.sm() # Additional headers. headers = com.headers() # Body list = com.getRolesList() roleName = random.choice(list) print("\n Updating Role ::", roleName) file = open("./tests_admin/testCases/update_role_api.json", 'r') body = json.loads(file.read()) body[ 'editedBy'] = 'abcde12345abcde12345abcde12345abcde12345abcde12345abcde' body['userRoleName'] = roleName com.update_role_negative(body, roleName) com.verify_updated_role_from_sm_with_api(roleName)
def test_updateRole_006(): logger = LogGen.loggen() com = Common_role_api() logger.info( "**************** Test_006: Test updateRole when user sends - editedBy empty Request ****************" ) logger.info( "https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) print( "**************** Test_006: Test updateRole when user sends - editedBy empty Request ****************" ) print( "Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) # Body list = com.getRolesList() roleName = random.choice(list) print("\n Updating Role - editedBy as null::", roleName) file = open("./tests_admin/testCases/update_role_api.json", 'r') body = json.loads(file.read()) body['editedBy'] = '' body['userRoleName'] = roleName com.update_role_negative(body, roleName) com.verify_updated_role_from_sm_with_api(roleName)
def test_updateRole_with_minimum_JSONBody_009(): logger = LogGen.loggen() com = Common_role_api() logger.info("**************** Test_009: Test updateRole when user sends - Valid Request with minimum Json Body****************") logger.info("https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50") print("**************** Test_009: Test updateRole when user sends - Valid Request with minimum Json Body****************") print("Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50") # Body list = com.getRolesList() roleName = random.choice(list) print("\n Updating Role ::", roleName) file = open("./tests_admin/testCases/update_role_api.json", 'r') body = json.loads(file.read()) body['deleteMethod'] = '' body['userRoleName'] = roleName # body = {'editedBy': 'admin', 'userRoleName': roleName, 'createMethod': 'true', 'editMethod': 'true', # 'deleteMethod': 'true', # 'createActionAlertLevel': 'true', 'editActionAlertLevel': 'true', 'deleteActionAlertLevel': 'true', # 'createHandlingRule': 'true', 'editHandlingRule': 'true', 'deleteHandlingRule': 'true', # 'createSample': 'false', 'editSample': 'false', 'deleteSample': 'false', 'createProduct': 'false', # 'editProduct': 'false', 'deleteProduct': 'false', 'createUser': '******', 'editUser': '******', # 'deleteUser': '******', 'createUserRole': 'false', 'editUserRole': 'false', 'deleteUserRole': 'false', # 'cancelCassettes': 'true', 'retrieveCassettes': 'true', 'approveCassettes': 'true', 'cleanupCassettes': 'true', # 'orderTests': 'true', 'loadTests': 'true', 'printProductLabels': 'true', 'administerGD': 'false', # 'editSettings': 'false', 'maintenance': 'false', 'acknowledgeSystemAlarms': 'true', # 'acknowledgeSystemErrors': 'true', 'acknowledgeSystemServiceIssues': 'true', 'editAlarmNotifications': 'false', # 'emptyTrash': 'true', 'service': 'false', 'editITSettings': 'false', 'editLimsSettings': 'false', # 'printLimsLabels': 'false', 'modifyLimsRequest': 'false', 'editLimsTestResultsFields': 'false' # } com.update_role_negative(body, roleName) com.verify_updated_role_from_sm_with_api(roleName)
def test_updateRole_002(): logger = LogGen.loggen() com = Common_role_api() logger.info( "**************** Test_002: Test updateRole when user sends - request body by changing parameters true/false ****************" ) logger.info( "https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) print( "**************** Test_002: Test updateRole when user sends - request body by changing parameters true/false ****************" ) print( "Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) # Body list = com.getRolesList() roleName = random.choice(list) print("\n Updating Role ::", roleName) list1 = ['true', 'false'] boolean_value = random.choice(list1) file = open("./tests_admin/testCases/update_role_api.json", 'r') body = json.loads(file.read()) body['createMethod'] = boolean_value body['deleteMethod'] = boolean_value body['createActionAlertLevel'] = boolean_value body['editActionAlertLevel'] = boolean_value body['createHandlingRule'] = boolean_value body['userRoleName'] = roleName com.update_role_positive(body, roleName) com.verify_updated_role_from_sm_with_api(roleName)
def test_updateRole_defaultRoles_008(): logger = LogGen.loggen() com = Common_role_api() logger.info( "**************** Test_008: Test updateRole when user sends - Request to update DefaultRoles(Default roles should not get update)****************" ) logger.info( "https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) print( "**************** Test_008: Test updateRole when user sends - Request to update DefaultRoles(Default roles should not get update)****************" ) print( "Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) # Body list = ['Administrator', 'Operator', 'Fieldservice'] roleName = random.choice(list) print("\n Updating Role ::", roleName) file = open("./tests_admin/testCases/update_role_api.json", 'r') body = json.loads(file.read()) body['userRoleName'] = roleName com.update_role_negative(body, roleName) com.verify_updated_role_from_sm_with_api(roleName)
def test_updateRole_values_apartFrom_true_false_007(): logger = LogGen.loggen() com = Common_role_api() logger.info("**************** Test_007: Test updateRole when user sends - Values apart from true or false ****************") logger.info("https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50") print("**************** Test_007: Test updateRole when user sends - Values apart from true or false ****************") print("Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50") list = com.getRolesList() roleName = random.choice(list) print("\n Updating Role ::", roleName) file = open("./tests_admin/testCases/update_role_api.json", 'r') body = json.loads(file.read()) body['deleteMethod'] = 1 body['userRoleName'] = roleName com.update_role_negative(body, roleName) com.verify_updated_role_from_sm_with_api(roleName)
def test_updateRole_with_Max_JSONBody_010(): logger = LogGen.loggen() com = Common_role_api() logger.info( "**************** Test_010: Test updateRole when user sends - request with maximum fileds in JSON body ****************" ) logger.info( "https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) print( "**************** Test_010: Test updateRole when user sends - request with maximum fileds in JSON body ****************" ) print( "Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) # Body list = com.getRolesList() roleName = random.choice(list) print("\n Updating Role ::", roleName) body = { 'editedBy': 'admin', 'userRoleName': roleName, 'createMethod': 'true', 'editMethod': 'true', 'deleteMethod': 'true', 'createActionAlertLevel': 'true', 'editActionAlertLevel': 'true', 'deleteActionAlertLevel': 'true', 'createHandlingRule': 'true', 'editHandlingRule': 'true', 'deleteHandlingRule': 'true', 'createSample': 'false', 'editSample': 'false', 'deleteSample': 'false', 'createProduct': 'false', 'editProduct': 'false', 'deleteProduct': 'false', 'createUser': '******', 'editUser': '******', 'deleteUser': '******', 'createUserRole': 'false', 'editUserRole': 'false', 'deleteUserRole': 'false', 'cancelCassettes': 'true', 'retrieveCassettes': 'true', 'approveCassettes': 'true', 'cleanupCassettes': 'true', 'orderTests': 'true', 'loadTests': 'true', 'printProductLabels': 'true', 'administerGD': 'false', 'editSettings': 'false', 'maintenance': 'false', 'acknowledgeSystemAlarms': 'true', 'acknowledgeSystemErrors': 'true', 'acknowledgeSystemServiceIssues': 'true', 'editAlarmNotifications': 'false', 'emptyTrash': 'true', 'service': 'false', 'editITSettings': 'false', 'editLimsSettings': 'false', 'printLimsLabels': 'false', 'modifyLimsRequest': 'false', 'editLimsTestResultsFields': 'false', 'sendSystemLogs': 'true' } com.update_role_positive(body, roleName) com.verify_updated_role_from_sm_with_api(roleName) e = com.verify_update_roleName_options(roleName) assert e['createMethod'] == True assert e['editMethod'] == True assert e['deleteMethod'] == True assert e['createActionAlertLevel'] == True assert e['editActionAlertLevel'] == True assert e['deleteActionAlertLevel'] == True assert e['createHandlingRule'] == True assert e['editHandlingRule'] == True assert e['deleteHandlingRule'] == True assert e['createSample'] == False assert e['editSample'] == False assert e['deleteSample'] == False assert e['createProduct'] == False assert e['editProduct'] == False assert e['deleteProduct'] == False assert e['createUser'] == False assert e['editUser'] == False assert e['deleteUser'] == False assert e['createUserRole'] == False assert e['editUserRole'] == False assert e['deleteUserRole'] == False assert e['cancelCassettes'] == True assert e['retrieveCassettes'] == True assert e['approveCassettes'] == True assert e['cleanupCassettes'] == True assert e['orderTests'] == True assert e['loadTests'] == True assert e['printProductLabels'] == True assert e['administerGD'] == False assert e['editSettings'] == False assert e['maintenance'] == False assert e['acknowledgeSystemAlarms'] == True assert e['acknowledgeSystemErrors'] == True assert e['acknowledgeSystemServiceIssues'] == True assert e['editAlarmNotifications'] == False assert e['emptyTrash'] == True assert e['service'] == False assert e['editITSettings'] == False assert e['editLimsSettings'] == False assert e['printLimsLabels'] == False assert e['modifyLimsRequest'] == False assert e['editLimsTestResultsFields'] == False assert e['sendSystemLogs'] == True
def test_updateRole_without_roleName_012(): logger = LogGen.loggen() com = Common_role_api() logger.info( "**************** Test_012: Test updateRole when user sends - Request without RoleName in JSON ****************" ) logger.info( "https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) print( "**************** Test_012: Test updateRole when user sends - Request without RoleName in JSON ****************" ) print( "Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) url = ReadConfig.sm() # Additional headers. headers = com.headers() # Body a = { 'editedBy': 'admin', 'createMethod': 'true', 'editMethod': 'true', 'deleteMethod': 'true', 'createActionAlertLevel': 'true', 'editActionAlertLevel': 'true', 'deleteActionAlertLevel': 'true', 'createHandlingRule': 'true', 'editHandlingRule': 'true', 'deleteHandlingRule': 'true', 'createSample': 'false', 'editSample': 'false', 'deleteSample': 'false', 'createProduct': 'false', 'editProduct': 'false', 'deleteProduct': 'false', 'createUser': '******', 'editUser': '******', 'deleteUser': '******', 'createUserRole': 'false', 'editUserRole': 'false', 'deleteUserRole': 'false', 'cancelCassettes': 'true', 'retrieveCassettes': 'true', 'approveCassettes': 'true', 'cleanupCassettes': 'true', 'orderTests': 'true', 'loadTests': 'true', 'printProductLabels': 'true', 'administerGD': 'false', 'editSettings': 'false', 'maintenance': 'false', 'acknowledgeSystemAlarms': 'true', 'acknowledgeSystemErrors': 'true', 'acknowledgeSystemServiceIssues': 'true', 'editAlarmNotifications': 'false', 'emptyTrash': 'true', 'service': 'false', 'editITSettings': 'false', 'editLimsSettings': 'false', 'printLimsLabels': 'false', 'modifyLimsRequest': 'false', 'editLimsTestResultsFields': 'false', 'sendSystemLogs': 'true' } # convert dict to json string by json.dumps() for body data. resp = requests.post(url + '/updateRole', headers=headers, data=json.dumps(a, indent=4)) print("\nResponse is :::\n", resp.text) assert resp.status_code != 200 logger.info("**************** Role not Updated ****************") print(" Role not updated")
def test_updateRole_editBy_with50Characters_004(): logger = LogGen.loggen() com = Common_role_api() logger.info( "**************** Test_004: Test updateRole when user sends - editBy with 50 characters ****************" ) logger.info( "https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) print( "**************** Test_004: Test updateRole when user sends - editBy with 50 characters ****************" ) print( "Jama link is ::https://rapidmicrobiosystems.jamacloud.com/perspective.req#/testCases/164302?projectId=50" ) list = com.getRolesList() roleName = random.choice(list) print("\n Updating Role ::", roleName) file = open("./tests_admin/testCases/update_role_api.json", 'r') body = json.loads(file.read()) body['editedBy'] = 'abcde12345abcde12345abcde12345abcde12345abcde12345' body['userRoleName'] = "vijay" com.update_role_positive(body, roleName) com.verify_updated_role_from_sm_with_api(roleName) e = com.verify_update_roleName_options(roleName) assert e['createMethod'] == True assert e['editMethod'] == True assert e['deleteMethod'] == True assert e['createActionAlertLevel'] == True assert e['editActionAlertLevel'] == True assert e['deleteActionAlertLevel'] == True assert e['createHandlingRule'] == True assert e['editHandlingRule'] == True assert e['deleteHandlingRule'] == True assert e['createSample'] == False assert e['editSample'] == False assert e['deleteSample'] == False assert e['createProduct'] == False assert e['editProduct'] == False assert e['deleteProduct'] == False assert e['createUser'] == False assert e['editUser'] == False assert e['deleteUser'] == False assert e['createUserRole'] == False assert e['editUserRole'] == False assert e['deleteUserRole'] == False assert e['cancelCassettes'] == True assert e['retrieveCassettes'] == True assert e['approveCassettes'] == True assert e['cleanupCassettes'] == True assert e['orderTests'] == True assert e['loadTests'] == True assert e['printProductLabels'] == True assert e['administerGD'] == False assert e['editSettings'] == False assert e['maintenance'] == False assert e['acknowledgeSystemAlarms'] == True assert e['acknowledgeSystemErrors'] == True assert e['acknowledgeSystemServiceIssues'] == True assert e['editAlarmNotifications'] == False assert e['emptyTrash'] == True assert e['service'] == False assert e['editITSettings'] == False assert e['editLimsSettings'] == False assert e['printLimsLabels'] == False assert e['modifyLimsRequest'] == False assert e['editLimsTestResultsFields'] == False assert e['sendSystemLogs'] == True