Beispiel #1
0
    def test_nominal_post_voucher(self, customer, db_conn, ids):
        ids = ids(with_balance=True, with_products=True, with_rlsid=True)
        code = get_voucher_code(customer, db_conn, ids.soc_id)
        cookies = get_session_id(customer, ids.customer_id)

        add_balance(db_conn, ids.rlsid, value=1)

        resp = AbcFactory(customer).payload_post_voucher(code[0]).post_voucher(
            ids.rlsid, ids.customer_id, cookies=cookies).resp

        assert_equals(customer, "CreditValue", float(code[1] / 100), resp.creditAdded)
Beispiel #2
0
    def test_post_voucher_with_invalid_code(self, code, customer, db_conn, ids):
        ids = ids(with_balance=True, with_products=True, with_rlsid=True)
        cookies = get_session_id(customer, ids.customer_id)

        resp = AbcFactory(customer).payload_post_voucher(code).post_voucher(
            ids.rlsid, ids.customer_id, Code.BAD_REQUEST, cookies=cookies).resp

        if code == "":
            assert_equals(customer, "Error reason", "PARAMETER", resp.ErrorReason)
        else:
            assert_error_message(customer, resp, ErrorDictAbc.VOUCHER_WRONG_CODE)
    def test_create_account_with_wrong_data(self, login, password, email,
                                            first_name, last_name, country,
                                            delete_empty_fields, customer,
                                            db_conn, ids):
        customer_id = ids(without_login=True).customer_id
        user_info = db_conn.ms_sql.get_user_info_by_customer_id(customer_id)

        resp = AbcFactory(customer).payload_creation(user_info, login, password, email, first_name, last_name, country).\
            create_account(customer_id, Code.BAD_REQUEST, delete_empty_fields=delete_empty_fields).resp

        assert_equals(customer, "Error reason", "INVALID_PARAMETER",
                      resp.ErrorReason)
        assert_tracking(customer,
                        db_conn,
                        customer_id,
                        Code.BAD_REQUEST,
                        Method.POST,
                        Url.ACCOUNTS,
                        by_url=True)
Beispiel #4
0
def assert_account(customer,
                   db_conn,
                   login,
                   locale,
                   account_must_be,
                   password=None,
                   customer_id=None,
                   registration_check=False):
    with run_wfe_webdriver(customer, customer.get_sfc_url()) as wd:
        login_page = LoginPage(wd, customer, customer.configurator, login,
                               password if password else 'tsl@123', locale)
        login_page.log_in(account_must_be=account_must_be)
    if customer.name == CustomerId.MVNE_BE_OBE_LMOBI and registration_check:
        query = db_conn.ms_sql.get_registration_process_type(f"+{customer_id}")
        customer.logger.assert_fail(query, "No registration process in db",
                                    f"{db_conn.ms_sql.last_query}")
        assert_equals(customer, "registration_type", "BLOCKED_DEFAULT_BE",
                      query["Type"])
        assert_equals(customer, "state", "NOT_REGISTERED", query["State"])
    def test_post_subscription_with_wrong_data(self, product_id, source,
                                               customer, payment_type, db_conn,
                                               ids):
        ids = ids(with_balance=True, with_rlsid=True)
        add_balance(db_conn, ids.rlsid)
        product_id = product_id if product_id or product_id == "" else \
            get_product_id(customer, db_conn, ids.customer_id, payment_type)

        resp = AbcFactory(customer).payload_post_subscription(product_id, payment_type, source=source).\
            post_subscriptions(ids.rlsid, ids.customer_id, Code.BAD_REQUEST, cookies=get_session_id(customer, ids.customer_id)).resp

        assert_tracking(customer,
                        db_conn,
                        ids.customer_id,
                        Code.BAD_REQUEST,
                        Method.POST,
                        Url.SUBSCRIPTIONS.format(ids.rlsid),
                        by_url=True)
        assert_equals(customer, "Error reason", "INVALID_PARAMETER",
                      resp.ErrorReason)
    def test_nominal_post_subscription_using_bancontact_method(
            self, customer, db_conn, ids, payment_type=PType.EXTERNAL_PAYMENT):
        ids = ids(without_login=True, check_customer=True, with_rlsid=True)
        create_account(customer, db_conn, ids.customer_id)
        product_id = get_product_id(customer, db_conn, ids.customer_id,
                                    payment_type)

        resp = AbcFactory(customer).payload_post_subscription(product_id, payment_type, payment_method="BANCONTACT").\
            post_subscriptions(ids.rlsid, ids.customer_id, cookies=get_session_id(customer, ids.customer_id)).resp

        assert_tracking(customer, db_conn, ids.customer_id, Code.OK,
                        Method.POST, Url.SUBSCRIPTIONS.format(ids.rlsid))
        assert_post_subscription(customer, resp, payment_type)

        # Finish payment using UI
        finish_bancontact_payment(customer, resp["paymentForm"]["url"])
        query = db_conn.ms_sql.get_registration_process_type(
            f"+{ids.customer_id}")
        customer.logger.assert_fail(query, "No registration process in db",
                                    db_conn.ms_sql.last_query)
        assert_equals(customer, "state", "TEMPORARY_REGISTERED",
                      query["State"])
def veirfy_page_title(context, pagetitle):
    asserts.assert_equals(Sample(context).get_title_current_page(), pagetitle, "Expected page is not found")
def click_search_btn(context, pagetitle):
    asserts.assert_equals(Sample(context).get_child_windoe_heading(), pagetitle, "child windows is not switched")
Beispiel #9
0
 def test_post_notifications_registration_without_token(self, customer, db_conn, ids):
     customer_id = ids().customer_id
     resp = AbcFactory(customer).payload_notifications(db_conn, token="").notification_registration(
         customer_id, Code.BAD_REQUEST).resp
     assert_equals(customer, "Error reason", "INVALID_PARAMETER", resp.ErrorReason)