def test_nominal_create_account(self, 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) client = AbcFactory(customer).payload_creation( user_info).create_account(customer_id) assert_tracking(customer, db_conn, customer_id, Code.CREATED, Method.POST, Url.ACCOUNTS) assert_account_creation_modification(customer, db_conn, client, customer_id)
def test_nominal_post_subscription_by_external_payment( 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).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)
def test_nominal_get_line_subscriptions(self, all_lines, by_status, customer, db_conn, ids): ids = ids(with_rlsid=True) client = AbcFactory(customer).subscriptions_params( by_status).get_subscriptions(ids.rlsid, ids.customer_id) assert_tracking(customer, db_conn, ids.customer_id, Code.OK, Method.GET, Url.SUBSCRIPTIONS.format(ids.rlsid), param=client.params.status if by_status else None) assert_for_get_subscriptions_tests(customer, db_conn, client, ids.customer_id, all_lines, by_status)
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)
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_by_main_credit(self, customer, db_conn, ids, payment_type=PType. MAIN_CREDIT): ids = ids(with_balance=True, with_rlsid=True) add_balance(db_conn, ids.rlsid) product_id = get_product_id(customer, db_conn, ids.customer_id, payment_type) resp = AbcFactory(customer).payload_post_subscription( product_id, payment_type).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)
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 test_nominal_get_account_info(self, customer, db_conn, ids): customer_id = ids().customer_id resp = AbcFactory(customer).get_account_info(customer_id).resp assert_tracking(customer, db_conn, customer_id, Code.OK, Method.GET, Url.ACCOUNTS_INFO) assert_not_none(customer, "iccid", resp.iccid)