def set_up(self): with allure.step("send an admin login request"): admin_success_login = SendRequest( Login.get_test_case("test_login_with_admin_success")) with allure.step("Get admin token"): TestLogOutWithAdminSuccess.admin_token = admin_success_login.get_token()
def set_up(self): with allure.step("Send an admin login request"): admin_success_login = SendRequest( Login.get_test_case("test_login_with_admin_success")) with allure.step("Get admin login token"): TestAdminStatusLoggedIn.admin_token = admin_success_login.get_token( )
def test_login_without_app_key(self): with allure.step('Send an admin login request without app key'): login_without_app_key = SendRequest(Login.get_test_case("test_login_without_app_key")) with allure.step('Checking msg'): allure.attach("Msg contains: " + constants.ERR_MSG_WITHOUT_APP_KEY, "Expected:") allure.attach("Msg: " + login_without_app_key.get_msg(), "Actual:") assert constants.ERR_MSG_WITHOUT_APP_KEY in login_without_app_key.get_msg() with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_400), "Expected:") allure.attach("Ret: " + str(login_without_app_key.get_ret()), "Actual:") assert login_without_app_key.get_ret() == constants.RET_400
def test_register_without_username(self): with allure.step('Send register request without username'): register_without_username = SendRequest(Register.get_test_case("test_register_without_username")) with allure.step('Checking msg'): allure.attach("Msg contains: " + constants.ERR_MSG_WITHOUT_USERNAME, "Expected:") allure.attach("Msg: " + register_without_username.get_msg(), "Actual:") assert constants.ERR_MSG_WITHOUT_USERNAME in register_without_username.get_msg() with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_400), "Expected:") allure.attach("Ret: " + str(register_without_username.get_ret()), "Actual:") assert register_without_username.get_ret() == constants.RET_400
def test_register_without_password(self): with allure.step('Send register request without password'): register_without_password = SendRequest(Register.get_test_case("test_register_without_password")) with allure.step('Checking msg'): allure.attach("Msg contains: " + constants.ERR_MSG_WITHOUT_PASSWORD, "Expected:") allure.attach("Msg: " + register_without_password.get_msg(), "Actual:") assert constants.ERR_MSG_WITHOUT_PASSWORD in register_without_password.get_msg() with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_400), "Expected:") allure.attach("Ret: " + str(register_without_password.get_ret()), "Actual:") assert register_without_password.get_ret() == constants.RET_400
def test_register_with_short_app_key(self): with allure.step("Send a register request with short app key"): register_with_short_app_key = SendRequest( Register.get_test_case("test_register_with_short_app_key")) with allure.step('Checking msg'): allure.attach("Msg contains: " + constants.ERR_MSG_SHORT_APP_KEY, "Expected:") allure.attach("Msg: " + register_with_short_app_key.get_msg(), "Actual:") assert constants.ERR_MSG_SHORT_APP_KEY in register_with_short_app_key.get_msg() with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_400), "Expected:") allure.attach("Ret: " + str(register_with_short_app_key.get_ret()), "Actual:") assert register_with_short_app_key.get_ret() == constants.RET_400
def test_logout_with_admin_success(self): with allure.step("Send an admin logout request"): admin_success_logout = SendRequest(Logout.get_test_case( "test_logout_with_admin_success", TestLogOutWithAdminSuccess.admin_token)) with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_200), "Expected:") allure.attach("Ret: " + str(admin_success_logout.get_ret()), "Actual:") assert admin_success_logout.get_ret() == constants.RET_200 with allure.step('Checking Err_code'): allure.attach("Err_code: " + str(constants.ERR_CODE_0), "Expected:") allure.attach("Err_code: " + str(admin_success_logout.get_err_code()), "Actual:") assert admin_success_logout.get_err_code() == constants.ERR_CODE_0
def test_login_with_nonexistent_username(self): with allure.step('Send a login request with nonexistent username'): login_with_nonexistent_username = SendRequest(Login.get_test_case("test_login_with_nonexistent_username")) with allure.step('Checking Err_msg'): allure.attach("Err_msg contains: " + constants.ERR_MSG_NONEXISTENT_USERNAME, "Expected:") allure.attach("Err_msg: " + login_with_nonexistent_username.get_err_msg(), "Actual:") assert constants.ERR_MSG_NONEXISTENT_USERNAME in login_with_nonexistent_username.get_err_msg() with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_200), "Expected:") allure.attach("Ret: " + str(login_with_nonexistent_username.get_ret()), "Actual:") assert login_with_nonexistent_username.get_ret() == constants.RET_200 with allure.step('Checking Err_code'): allure.attach("Err_code: " + str(constants.ERR_CODE_1), "Expected:") allure.attach("Err_code: " + str(login_with_nonexistent_username.get_err_code()), "Actual:") assert login_with_nonexistent_username.get_err_code() == constants.ERR_CODE_1
def test_log_out_without_uuid(self): with allure.step("Send an admin logout request"): logout_without_uuid = SendRequest( Logout.get_test_case("test_logout_without_uuid", constants.TMP_TOKEN)) with allure.step('Checking msg'): allure.attach("Msg contains " + constants.ERR_MSG_WITHOUT_UUID, "Expected:") allure.attach("Msg: " + logout_without_uuid.get_msg(), "Actual:") assert constants.ERR_MSG_WITHOUT_UUID in logout_without_uuid.get_msg( ) with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_400), "Expected:") allure.attach("Ret: " + str(logout_without_uuid.get_ret()), "Actual:") assert logout_without_uuid.get_ret() == constants.RET_400
def test_register_with_existing_username(self): with allure.step("Send a register request with existing username"): register_with_existing_username = SendRequest( Register.get_test_case("test_register_with_existing_username")) with allure.step('Checking Err_msg'): allure.attach("Err_msg contains: " + constants.ERR_MSG_EXISTING_USERNAME, "Expected:") allure.attach("Err_msg: " + register_with_existing_username.get_err_msg(), "Actual:") assert constants.ERR_MSG_EXISTING_USERNAME in register_with_existing_username.get_err_msg() with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_200), "Expected:") allure.attach("Ret: " + str(register_with_existing_username.get_ret()), "Actual:") assert register_with_existing_username.get_ret() == constants.RET_200 with allure.step('Checking Err_code'): allure.attach("Err_code: " + str(constants.ERR_CODE_1), "Expected:") allure.attach("Err_code: " + str(register_with_existing_username.get_err_code()), "Actual:") assert register_with_existing_username.get_err_code() == constants.ERR_CODE_1
def test_users_list_with_0_per_page(self): with allure.step("Send a get list request with 0 per page"): users_list_with_0_per_page = SendRequest(UsersList.get_test_case("test_users_list_with_0_per_page")) with allure.step('Checking if per page is equal to 0'): is_per_page_equal_to_0 = len(users_list_with_0_per_page.get_users_list()) == int(constants.PER_PAGE_0) allure.attach("Per page is equal to 0: True", "Expected:") allure.attach("Per page is equal to 0" + str(is_per_page_equal_to_0), "Actual:") assert is_per_page_equal_to_0 is True with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_200), "Expected:") allure.attach("Ret: " + str(users_list_with_0_per_page.get_ret()), "Actual:") assert users_list_with_0_per_page.get_ret() == constants.RET_200 with allure.step('Checking Err_code'): allure.attach("Err_code: " + str(constants.ERR_CODE_0), "Expected:") allure.attach("Err_code: " + str(users_list_with_0_per_page.get_err_code()), "Actual:") assert users_list_with_0_per_page.get_err_code() == constants.ERR_CODE_0
def test_users_list_with_101_per_page(self): with allure.step("Send a get list request with 101 per page"): users_list_with_101_per_page = SendRequest( UsersList.get_test_case("test_users_list_with_101_per_page")) with allure.step('Checking msg'): allure.attach( "Msg: " + str(constants.ERR_MSG_USERS_LIST_101_PER_PAGE), "Expected:") allure.attach( "Msg: " + str(users_list_with_101_per_page.get_msg()), "Actual:") assert constants.ERR_MSG_USERS_LIST_101_PER_PAGE in users_list_with_101_per_page.get_msg( ) with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_400), "Expected:") allure.attach( "Ret: " + str(users_list_with_101_per_page.get_ret()), "Actual:") assert users_list_with_101_per_page.get_ret() == constants.RET_400
def test_users_list_get_regular_user(self): with allure.step( "Send a get list request with role user, page 2 and 15 per page" ): all_regular_users_list = SendRequest( UsersList.get_test_case("test_users_list_get_regular_users")) with allure.step('Checking if per page is less or equal 15'): is_per_page_less_or_equal_15 = len( all_regular_users_list.get_users_list()) <= int( constants.PER_PAGE_15) allure.attach("Per page is less or equal 15: True", "Expected:") allure.attach( "Per page is less or equal 15" + str(is_per_page_less_or_equal_15), "Actual:") assert is_per_page_less_or_equal_15 is True with allure.step('Checking if all user type return'): is_all_users_type_return = all_regular_users_list.is_all_users_type_in_the_list( ) allure.attach("All users type return: True", "Expected:") allure.attach( "All users type return: " + str(all_regular_users_list), "Actual:") assert is_all_users_type_return is True with allure.step('Checking Ret'): allure.attach("Ret: " + str(constants.RET_200), "Expected:") allure.attach("Ret: " + str(all_regular_users_list.get_ret()), "Actual:") assert all_regular_users_list.get_ret() == constants.RET_200 with allure.step('Checking Err_code'): allure.attach("Err_code: " + str(constants.ERR_CODE_0), "Expected:") allure.attach( "Err_code: " + str(all_regular_users_list.get_err_code()), "Actual:") assert all_regular_users_list.get_err_code( ) == constants.ERR_CODE_0