def test_logout_unauthorized(self, customer, db_conn, ids): customer_id = ids().customer_id assert_error_message( customer, AbcFactory(customer).payload_logout().logout( customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
def test_get_account_info_unauthorized(self, customer, db_conn, ids): customer_id = ids().customer_id assert_error_message( customer, AbcFactory(customer).get_account_info(customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
def test_validate_generated_code_with_invalid_code(self, customer, db_conn, ids): customer_id = ids(without_login=True).customer_id assert_error_message( customer, BoboFactory(customer).payload_code_validate( customer_id, "12345").validate_code(Code.BAD_REQUEST).resp, ErrorDictBobo.INVALID_AUTH_CODE)
def test_get_line_subscriptions_unauthorized(self, customer, db_conn, ids): ids = ids(with_rlsid=True) assert_error_message( customer, AbcFactory(customer).subscriptions_params().get_subscriptions( ids.rlsid, ids.customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
def test_get_products_unauthorized(self, customer, ids): ids = ids(with_rlsid=True) assert_error_message( customer, AbcFactory(customer).products_params().get_products( ids.rlsid, ids.customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
def test_create_account_unauthorized(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) assert_error_message( customer, AbcFactory(customer).payload_creation(user_info).create_account( customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
def test_change_password_unauthorized(self, customer, db_conn, ids): customer_id = ids().customer_id assert_error_message( customer, AbcFactory(customer).payload_change_password( get_md5_password()).change_password(customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
def test_get_subscriber_registration_unauthorized(self, customer, db_conn, ids): ids = ids(with_registration=True) assert_error_message( customer, AbcFactory(customer).get_subscriber_registration( ids.rlsid, ids.customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
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_change_password_to_the_same(self, customer, db_conn, ids): factory = AbcFactory(customer) customer_id = ids().customer_id new_pass = get_md5_password() cookie = get_session_id(customer, customer_id) factory.payload_change_password(new_pass).change_password( customer_id, cookies=cookie) resp = factory.payload_change_password(new_pass).change_password( customer_id, Code.BAD_REQUEST, cookies=cookie).resp assert_error_message(customer, resp, ErrorDictAbc.PASSWORD_UNCHANGED)
def test_get_registration_process_unauthorized(self, customer, db_conn, ids, country="QQ"): ids = ids(with_rlsid=True) assert_error_message( customer, AbcFactory(customer).get_registration_process( ids.rlsid, country, ids.customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
def test_post_subscription_unauthorized(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, Code.UNAUTHORIZED, unauthorised=True).resp assert_error_message(customer, resp, ErrorDictAbc.UNAUTHORIZED)
def test_generate_validation_code_with_invalid_customer_id(self, customer): assert_error_message(customer, AbcFactory(customer).payload_code_generate(INVALID_CLIENTID).generate_code( Code.NOT_FOUND).resp, ErrorDictAbc.CLIENTID_NOT_FOUND)
def test_post_voucher_unauthorized(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) assert_error_message(customer, AbcFactory(customer).payload_post_voucher(code[0]).post_voucher( ids.rlsid, ids.customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)
def test_post_notifications_registration_unauthorized(self, customer, db_conn, ids): customer_id = ids().customer_id assert_error_message(customer, AbcFactory(customer).payload_notifications(db_conn).notification_registration( customer_id, Code.UNAUTHORIZED, unauthorised=True).resp, ErrorDictAbc.UNAUTHORIZED)