Exemplo n.º 1
0
    def test_alter_password_success(self):
        with allure.step('Send alter password request(success)'):
            alter_password_success = SendRequest(
                AlterPassword.get_test_case("test_alter_password_success"))

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_200), "Expected:")
            allure.attach("Ret: " + str(alter_password_success.get_ret()),
                          "Actual:")
            assert alter_password_success.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(alter_password_success.get_err_code()),
                "Actual:")
            assert alter_password_success.get_err_code(
            ) == constants.ERR_CODE_0

        with allure.step('Checking if the user can log in with new password'):
            login_with_new_password = SendRequest(
                Login.get_test_case("test_login_with_new_password"))

            allure.attach(
                "Ret = " + str(constants.RET_200) + "and Err_code = " +
                str(constants.ERR_CODE_0), "Expected:")
            allure.attach(
                "Ret = " + str(constants.ERR_CODE_0) + "Err_code =  " +
                str(alter_password_success.get_err_code()), "Actual:")
            assert login_with_new_password.get_ret() == constants.RET_200
            assert login_with_new_password.get_err_code(
            ) == constants.ERR_CODE_0
Exemplo n.º 2
0
    def test_login_with_banned_username(self):
        with allure.step('Send a login request with banned username'):
            login_with_banned_username = SendRequest(
                Login.get_test_case("test_login_with_banned_username"))

        with allure.step('Checking Err_msg'):
            allure.attach(
                "Err_msg contains: " +
                constants.ERR_MSG_WRONG_PASSWORD_OR_BANNED_USERNAME,
                "Expected:")
            allure.attach(
                "Err_msg: " + login_with_banned_username.get_err_msg(),
                "Actual:")
            assert constants.ERR_MSG_WRONG_PASSWORD_OR_BANNED_USERNAME in login_with_banned_username.get_err_msg(
            )

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_200), "Expected:")
            allure.attach("Ret: " + str(login_with_banned_username.get_ret()),
                          "Actual:")
            assert login_with_banned_username.get_ret() == constants.RET_200

        with allure.step('Checking Err_code'):
            allure.attach("Err_code: " + str(constants.ERR_CODE_2),
                          "Expected:")
            allure.attach(
                "Err_code: " + str(login_with_banned_username.get_err_code()),
                "Actual:")
            assert login_with_banned_username.get_err_code(
            ) == constants.ERR_CODE_2
Exemplo n.º 3
0
    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(
            )
Exemplo n.º 5
0
    def test_login_with_short_username(self):
        with allure.step('Send a login request with short username'):
            login_with_short_username = SendRequest(Login.get_test_case("test_login_with_short_username"))

        with allure.step('Checking msg'):
            allure.attach("Msg contains: " + constants.ERR_MSG_SHORT_USERNAME, "Expected:")
            allure.attach("Msg: " + login_with_short_username.get_msg(), "Actual:")
            assert constants.ERR_MSG_SHORT_USERNAME in login_with_short_username.get_msg()

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_400), "Expected:")
            allure.attach("Ret: " + str(login_with_short_username.get_ret()), "Actual:")
            assert login_with_short_username.get_ret() == constants.RET_400
Exemplo n.º 6
0
    def test_login_with_long_password(self):
        with allure.step('Send a login request with long password'):
            login_with_long_password = SendRequest(Login.get_test_case("test_login_with_long_password"))

        with allure.step('Checking msg'):
            allure.attach("Msg contains: " + constants.ERR_MSG_LONG_PASSWORD, "Expected:")
            allure.attach("Msg: " + login_with_long_password.get_msg(), "Actual:")
            assert constants.ERR_MSG_LONG_PASSWORD in login_with_long_password.get_msg()

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_400), "Expected:")
            allure.attach("Ret: " + str(login_with_long_password.get_ret()), "Actual:")
            assert login_with_long_password.get_ret() == constants.RET_400
Exemplo n.º 7
0
    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
Exemplo n.º 8
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
Exemplo n.º 9
0
    def test_login_with_regular_user_success(self):
        with allure.step('Send a valid regular user login request'):
            login_with_regular_user_success = SendRequest(
                Login.get_test_case("test_login_with_regular_user_success"))

        with allure.step('Checking Uuid'):
            allure.attach("Uuid: " + constants.USER_UUID, "Expected:")
            allure.attach(
                "Uuid: " + login_with_regular_user_success.get_uuid(),
                "Actual:")
            assert login_with_regular_user_success.get_uuid(
            ) == constants.USER_UUID

        with allure.step('Checking role'):
            allure.attach("Role: " + constants.ROLE_USER, "Expected:")
            allure.attach(
                "Role: " + login_with_regular_user_success.get_role(),
                "Actual:")
            assert login_with_regular_user_success.get_role(
            ) == constants.ROLE_USER

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_200), "Expected:")
            allure.attach(
                "Ret: " + str(login_with_regular_user_success.get_ret()),
                "Actual:")
            assert login_with_regular_user_success.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(login_with_regular_user_success.get_err_code()), "Actual:")
            assert login_with_regular_user_success.get_err_code(
            ) == constants.ERR_CODE_0