def test_alter_password_with_short_new_password(self):
        with allure.step(
                'Send alter password request with short new password'):
            alter_password_with_short_new_password = SendRequest(
                AlterPassword.get_test_case(
                    "test_alter_password_with_short_new_password"))

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

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_400), "Expected:")
            allure.attach(
                "Ret: " +
                str(alter_password_with_short_new_password.get_ret()),
                "Actual:")
            assert alter_password_with_short_new_password.get_ret(
            ) == constants.RET_400
    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
    def test_alter_password_without_app_key(self):
        with allure.step('Send alter password request without app key'):
            alter_password_without_app_key = SendRequest(
                AlterPassword.get_test_case("test_alter_password_without_app_key"))

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

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_400), "Expected:")
            allure.attach("Ret: " + str(alter_password_without_app_key.get_ret()), "Actual:")
            assert alter_password_without_app_key.get_ret() == constants.RET_400
    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
Exemple #5
0
    def test_alter_password_with_short_username(self):
        with allure.step('Send alter password request with short username'):
            alter_password_with_short_username = SendRequest(
                AlterPassword.get_test_case(
                    "test_alter_password_with_short_username"))

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

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_400), "Expected:")
            allure.attach(
                "Ret: " + str(alter_password_with_short_username.get_ret()),
                "Actual:")
            assert alter_password_with_short_username.get_ret(
            ) == constants.RET_400
    def test_alter_password_without_old_password(self):
        with allure.step('Send alter password request without old password'):
            alter_password_without_old_password = SendRequest(
                AlterPassword.get_test_case(
                    "test_alter_password_without_old_password"))

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

        with allure.step('Checking Ret'):
            allure.attach("Ret: " + str(constants.RET_400), "Expected:")
            allure.attach(
                "Ret: " + str(alter_password_without_old_password.get_ret()),
                "Actual:")
            assert alter_password_without_old_password.get_ret(
            ) == constants.RET_400
 def set_up(self):
     yield
     with allure.step('Reset back the password'):
         SendRequest(
             AlterPassword.get_test_case(
                 "test_alter_password_reset_back_password"))