Example #1
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
    def test_check_user_status_with_wrong_uuid(self):
        with allure.step("Send check user status request with wrong uuid"):
            check_user_status_with_wrong_uuid = SendRequest(
                CheckUserStatus.get_test_case("test_check_user_status_with_wrong_uuid"))

        with allure.step("Checking err msg"):
            allure.attach("Err msg contains: " + constants.ERR_MSG_CHECK_WRONG_TOKEN_OR_UUID, "Expected")
            allure.attach("Err msg: " + check_user_status_with_wrong_uuid.get_err_msg(), "Actual:")
            assert constants.ERR_MSG_CHECK_WRONG_TOKEN_OR_UUID in check_user_status_with_wrong_uuid.get_err_msg()

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_200), "Expected:")
            allure.attach("Ret: " + str(check_user_status_with_wrong_uuid.get_ret()), "Actual:")
            assert check_user_status_with_wrong_uuid.get_ret() == constants.RET_200
Example #3
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_alter_password_with_same_password(self):
        with allure.step('Send alter password request with same password'):
            alter_password_same_password = SendRequest(
                AlterPassword.get_test_case("test_alter_password_with_same_password"))

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

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