示例#1
0
def test_invalid_phones(client, phone):
    email = 'foo'
    dct = {'name': 'Foo Bar Baz', 'email': email, 'phone': phone}
    resp = client.post(
        reverse('django_pagarme:contact_info', kwargs={'slug': 'pytools'}),
        dct)
    assert_contains(resp, phone, status_code=400)
    assert_contains(resp, email, status_code=400)
示例#2
0
def test_user_data_on_form(resp_logged_user, logged_user):
    data = {
        'external_id': str(logged_user.id),
        'name': logged_user.first_name,
        'email': logged_user.email,
    }
    for k, v in data.items():
        assert_contains(resp_logged_user, f"{k}: '{v}'")
示例#3
0
def test_customer_qs_precedes_logged_user(resp_logged_user_and_customer_qs, logged_user, customer_query_string_data):
    data = {
        'external_id': str(logged_user.id),
    }
    data.update(customer_query_string_data)
    for k, v in data.items():
        if k != 'phone':
            assert_contains(resp_logged_user_and_customer_qs, f"{k}: '{v}'")
        else:
            assert_contains(resp_logged_user_and_customer_qs, v)
def test_payment_profile_precedes_logged_user(
        resp_logged_user_with_payment_profile,
        payment_profile: UserPaymentProfile):
    assert_contains(resp_logged_user_with_payment_profile,
                    str(payment_profile.phone))
    assert_contains(resp_logged_user_with_payment_profile,
                    payment_profile.name)
    assert_contains(resp_logged_user_with_payment_profile,
                    payment_profile.document_number)
    assert_contains(resp_logged_user_with_payment_profile,
                    payment_profile.document_type)
    assert_contains(resp_logged_user_with_payment_profile,
                    payment_profile.customer_type)
示例#5
0
def test_free_installment(resp, payment_config: PagarmeFormConfig):
    assert_contains(resp,
                    f'freeInstallments: {payment_config.free_installment}')
示例#6
0
def test_default_installment(resp, payment_config: PagarmeFormConfig):
    assert_contains(
        resp, f'defaultInstallment: {payment_config.default_installment}')
示例#7
0
def test_max_installments(resp, payment_config: PagarmeFormConfig):
    assert_contains(resp,
                    f'maxInstallments: {payment_config.max_installments}')
def test_logged_user_email_is_present(resp_absent_profile_with_user, logged_user):
    assert_contains(resp_absent_profile_with_user, logged_user.email)
def test_downsell_link_present(resp, payment_item, upsell_item):
    assert_contains(resp, reverse('django_pagarme:one_click', kwargs={'slug': upsell_item.slug}))
示例#10
0
def test_pagarme_javascript(client):
    resp = client.get(reverse('pagamentos:produto'))
    assert_contains(resp, 'script src="//assets.pagar.me/checkout/1.1.0/checkout.js"')
示例#11
0
def test_payment_methods(resp, payment_config: PagarmeFormConfig):
    assert_contains(resp,
                    f"paymentMethods: '{payment_config.payments_methods}'")
示例#12
0
def test_name(resp, payment_item: PagarmeItemConfig):
    assert_contains(resp, f"title: '{payment_item.name}'")
示例#13
0
def test_interest_rate(resp, payment_config: PagarmeFormConfig):
    assert_contains(resp, f'interestRate: {payment_config.interest_rate:.2f}')
def test_logged_user_first_name_is_present(resp_absent_profile_with_user, logged_user):
    assert_contains(resp_absent_profile_with_user, logged_user.first_name)
def test_profile_phone_is_present(resp_with_payment_profile, payment_profile):
    assert_contains(resp_with_payment_profile, payment_profile.phone)
def test_profile_first_name_is_present(resp_with_payment_profile, payment_profile):
    assert_contains(resp_with_payment_profile, payment_profile.name)
def test_profile_email_is_present(resp_with_payment_profile, payment_profile):
    assert_contains(resp_with_payment_profile, payment_profile.email)
示例#18
0
def test_slug(resp, payment_item: PagarmeItemConfig):
    assert_contains(resp, f"id: '{payment_item.slug}'")
示例#19
0
def test_customer_data_on_form(resp_customer_on_query_string,
                               customer_query_string_data):
    for v in customer_query_string_data.values():
        assert_contains(resp_customer_on_query_string, v)
示例#20
0
def test_tangible(resp, payment_item: PagarmeItemConfig):
    assert_contains(resp, f"tangible: '{str(payment_item.tangible).lower()}'")
示例#21
0
def test_pagarme_javascript(resp):
    assert_contains(
        resp, 'script src="//assets.pagar.me/checkout/1.1.0/checkout.js"')
示例#22
0
def test_modal_open(resp_open_modal):
    assert_contains(resp_open_modal, 'setTimeout(initiateCheckout, 1000);')
示例#23
0
def test_encription_key_is_present(settings, resp):
    assert_contains(resp, settings.CHAVE_PAGARME_CRIPTOGRAFIA_PUBLICA)
示例#24
0
def test_encription_key_is_present(client, settings):
    resp = client.get(reverse('pagamentos:produto'))
    assert_contains(resp, settings.CHAVE_LINDART_CRIPTOGRAFIA_PUBLICA)
示例#25
0
def test_unit_price(resp, payment_item: PagarmeItemConfig):
    assert_contains(resp, f"unit_price: {payment_item.price}")
def test_success_boleto_data(resp):
    payment = facade.find_payment_by_transaction(TRANSACTION_ID)
    assert_contains(resp, payment.boleto_barcode)
    assert_contains(resp, payment.boleto_url)
示例#27
0
def test_upsell_one_click(resp, upsell):
    assert_contains(
        resp, reverse('django_pagarme:one_click', kwargs={'slug':
                                                          upsell.slug}))