本文整理汇总了Python中shuup_tests.utils.SmartClient.get方法的典型用法代码示例。如果您正苦于以下问题:Python SmartClient.get方法的具体用法?Python SmartClient.get怎么用?Python SmartClient.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shuup_tests.utils.SmartClient
的用法示例。
在下文中一共展示了SmartClient.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_injection
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_update_injection():
shop = factories.get_default_shop()
client = SmartClient()
index_url = reverse("shuup:index")
page = ensure_gdpr_privacy_policy(shop)
shop_gdpr = GDPRSettings.get_for_shop(shop)
shop_gdpr.enabled = True
shop_gdpr.privacy_policy = page
shop_gdpr.save()
assert_update(client, index_url, False) # nothing consented in past, should not show
user = factories.create_random_user("en")
password = "test"
user.set_password(password)
user.save()
client.login(username=user.username, password=password)
assert_update(client, index_url, False) # no consent given, should not be visible
create_user_consent_for_all_documents(shop, user)
assert_update(client, index_url, False)
with reversion.create_revision():
page.save()
assert not is_documents_consent_in_sync(shop, user)
assert_update(client, index_url, True)
# consent
client.get(reverse("shuup:gdpr_policy_consent", kwargs=dict(page_id=page.pk)))
assert is_documents_consent_in_sync(shop, user)
assert_update(client, index_url, False)
示例2: test_consent_cookies
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_consent_cookies():
"""
Test that the GDPR consent is generated and saved into a cooki
"""
for code, lang in settings.LANGUAGES:
activate(code)
shop = factories.get_default_shop()
client = SmartClient()
index_url = reverse("shuup:index")
response = client.get(index_url)
# create a GDPR setting for the shop
shop_gdpr = GDPRSettings.get_for_shop(shop)
shop_gdpr.cookie_banner_content = "my cookie banner content"
shop_gdpr.cookie_privacy_excerpt = "my cookie privacyexcerpt"
shop_gdpr.enabled = True
shop_gdpr.save()
# create cookie categories
required_cookie_category = GDPRCookieCategory.objects.create(
shop=shop,
always_active=True,
cookies="cookie1,cookir2,_cookie3",
name="RequiredCookies",
how_is_used="to make the site work"
)
optional_cookie_category = GDPRCookieCategory.objects.create(
shop=shop,
always_active=False,
cookies="_opt1,_opt2,_opt3",
name="OptionalCookies",
how_is_used="to spy users"
)
# create privacy policy GDPR document
privacy_policy = ensure_gdpr_privacy_policy(shop)
response = client.get(index_url)
assert settings.SHUUP_GDPR_CONSENT_COOKIE_NAME not in response.cookies
# send consent
response = client.post(reverse("shuup:gdpr_consent"), data={
"cookie_category_{}".format(required_cookie_category.id): "on",
"cookie_category_{}".format(optional_cookie_category.id): "on"
})
assert settings.SHUUP_GDPR_CONSENT_COOKIE_NAME in response.cookies
cookies_data = json.loads(response.cookies[settings.SHUUP_GDPR_CONSENT_COOKIE_NAME].value)
assert privacy_policy.id == cookies_data["documents"][0]["id"]
assert privacy_policy.url == cookies_data["documents"][0]["url"]
for cookie in required_cookie_category.cookies.split(","):
assert cookie in cookies_data["cookies"]
for cookie in optional_cookie_category.cookies.split(","):
assert cookie in cookies_data["cookies"]
示例3: test_shop_remove_available_languages
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_shop_remove_available_languages(admin_user):
shop = factories.get_default_shop()
client = SmartClient()
with override_settings(
LANGUAGES=[
("en", "English"),
("fi", "Finnish"),
],
LANGUAGE_CODE="en",
PARLER_DEFAULT_LANGUAGE_CODE = "en"
):
# there is no language set for the shop, the first one will be used
response = client.get(reverse("shuup:index"))
assert get_language() == "en"
# request js catalog file
response = client.get(reverse("shuup:js-catalog"))
assert get_language() == "en"
# when requesting admin js catalog, the language should be any of the available
client.get("shuup_admin:js-catalog")
assert get_language() == "en"
set_shop_available_languages(shop, ["fi"])
response = client.get(reverse("shuup:index"))
assert get_language() == "fi"
response = client.get(reverse("shuup:js-catalog"))
assert get_language() == "fi"
client.get("shuup_admin:js-catalog")
assert get_language() == "en"
示例4: test_get_installments_12x_with_simples_intereset
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_get_installments_12x_with_simples_intereset():
"""
Max 12 installs with PRICE intereset
interest_rate = 2.30%
min_installment_amount = 30.00
"""
patch_cielo_request()
shop = get_default_shop()
create_default_order_statuses()
populate_if_required()
set_current_theme('shuup.themes.classic_gray')
c = SmartClient()
_configure_basket(c)
cielo_config = CieloConfig.objects.create(shop=shop,
max_installments=12,
installments_without_interest=2,
interest_type=InterestType.Price,
interest_rate=Decimal(2.3),
min_installment_amount=Decimal(30))
order_total = (PRODUCT_QTNTY * PRODUCT_PRICE)
installment_choices = InstallmentContext(order_total, cielo_config).get_intallments_choices()
response = c.get(INSTALLMENTS_PATH, {"cc_brand": CieloCardBrand.Visa})
json_content = json.loads(response.content.decode("utf-8"))
assert len(json_content['installments']) == len(installment_choices)
for installment in range(len(installment_choices)):
total = format_money(shop.create_price(installment_choices[installment][2]))
installment_amount = format_money(shop.create_price(installment_choices[installment][1]))
assert json_content['installments'][installment]['number'] == installment+1
assert installment_amount in json_content['installments'][installment]['name']
assert total in json_content['installments'][installment]['name']
示例5: test_get_installments_3x_no_intereset
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_get_installments_3x_no_intereset():
"""
Max 3 installs with no intereset
"""
patch_cielo_request()
shop = get_default_shop()
create_default_order_statuses()
populate_if_required()
set_current_theme('shuup.themes.classic_gray')
c = SmartClient()
_configure_basket(c)
CieloConfig.objects.create(shop=shop,
max_installments=3,
installments_without_interest=3)
order_total = PRODUCT_QTNTY * PRODUCT_PRICE
total_price_str = "{0}".format(format_money(shop.create_price(order_total)))
response = c.get(INSTALLMENTS_PATH, {"cc_brand": CieloCardBrand.Visa})
json_content = json.loads(response.content.decode("utf-8"))
assert len(json_content['installments']) == 3
assert json_content['installments'][0]['number'] == 1
assert total_price_str in json_content['installments'][0]['name']
total_2x_no_interest = format_money(shop.create_price(order_total / Decimal(2)))
assert json_content['installments'][1]['number'] == 2
assert total_price_str in json_content['installments'][1]['name']
assert total_2x_no_interest in json_content['installments'][1]['name']
total_3x_no_interest = format_money(shop.create_price(order_total / Decimal(3)))
assert json_content['installments'][2]['number'] == 3
assert total_price_str in json_content['installments'][2]['name']
assert total_3x_no_interest in json_content['installments'][2]['name']
示例6: test_get_installments_cc_does_not_allow_installments
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_get_installments_cc_does_not_allow_installments():
"""
Max 9 installs with SIMPLE intereset
interest_rate = 4.00%
Credit card does not allow installments
"""
patch_cielo_request()
shop = get_default_shop()
create_default_order_statuses()
populate_if_required()
set_current_theme('shuup.themes.classic_gray')
c = SmartClient()
_configure_basket(c)
CieloConfig.objects.create(shop=shop,
max_installments=9,
installments_without_interest=3,
interest_type=InterestType.Simple,
interest_rate=Decimal(4.0))
order_total = (PRODUCT_QTNTY * PRODUCT_PRICE)
total_price_str = "{0}".format(format_money(shop.create_price(order_total)))
response = c.get(INSTALLMENTS_PATH, {"cc_brand": CieloCardBrand.Discover})
json_content = json.loads(response.content.decode("utf-8"))
assert len(json_content['installments']) == 1
assert json_content['installments'][0]['number'] == 1
assert total_price_str in json_content['installments'][0]['name']
示例7: test_resource_injection
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_resource_injection(client):
"""
Test that the GDPR warning is injected into the front template when enabled
"""
activate("en")
shop = factories.get_default_shop()
client = SmartClient()
index_url = reverse("shuup:index")
response = client.get(index_url)
assert "gdpr-consent-warn-bar" not in response.content.decode("utf-8")
# create a GDPR setting for the shop
shop_gdpr = GDPRSettings.get_for_shop(shop)
shop_gdpr.cookie_banner_content = "my cookie banner content"
shop_gdpr.cookie_privacy_excerpt = " my cookie privacyexcerpt"
shop_gdpr.enabled = True
shop_gdpr.save()
# the contents should be injected in the html
response = client.get(index_url)
response_content = response.content.decode("utf-8")
assert "gdpr-consent-warn-bar" in response_content
assert shop_gdpr.cookie_banner_content in response_content
assert shop_gdpr.cookie_privacy_excerpt in response_content
# create cookie categories
cookie_category = GDPRCookieCategory.objects.create(
shop=shop,
always_active=True,
cookies="cookie1,cookie2,_cookie3",
name="RequiredCookies",
how_is_used="to make the site work"
)
response = client.get(index_url)
response_content = response.content.decode("utf-8")
assert "gdpr-consent-warn-bar" in response_content
assert cookie_category.cookies in response_content
assert cookie_category.name in response_content
assert cookie_category.how_is_used in response_content
# make sure no other shop has this
with override_settings(SHUUP_ENABLE_MULTIPLE_SHOPS=True):
shop2 = factories.get_shop(identifier="shop2", status=ShopStatus.DISABLED, domain="shop2")
response = client.get(index_url, HTTP_HOST=shop2.domain)
response_content = response.content.decode("utf-8")
assert "gdpr-consent-warn-bar" not in response_content
示例8: test_shop_available_languages
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_shop_available_languages(admin_user):
original_language = get_language()
shop = factories.get_default_shop()
client = SmartClient()
with override_settings(
LANGUAGES=[
("it", "Italian"),
("fr", "French"),
("fi", "Finnish"),
("pt", "Portuguese")
],
LANGUAGE_CODE="it",
PARLER_DEFAULT_LANGUAGE_CODE = "it"
):
# there is no language set for the shop, the first one will be used
response = client.get(reverse("shuup:index"))
assert get_language() == "it"
# set an invalid language code
with pytest.raises(ValueError):
set_shop_available_languages(shop, ["xpto"])
# limit the langauges for the shop to "fi" and "pt"
set_shop_available_languages(shop, ["fi", "pt"])
# the middleware will automatically set the language to "fi" as that is the first one available for the shop
response = client.get(reverse("shuup:index"))
assert get_language() == "fi"
# the same won't happen for any other url - the middleware will only affect front urls
client.get("shuup_admin:index")
assert get_language() == "it"
# test againt front again
client.get(reverse("shuup:index"))
assert get_language() == "fi"
# again for admin
client.get("shuup_admin:index")
assert get_language() == "it"
# remote all available languages
set_shop_available_languages(shop, [])
# this should fallback to settings.LAGUAGE_CODE
response = client.get(reverse("shuup:index"))
assert get_language() == "it"
activate(original_language)
示例9: test_download_examples
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_download_examples(rf, admin_user):
shop = get_default_shop()
import_url = reverse("shuup_admin:importer.import")
shop.staff_members.add(admin_user)
client = SmartClient()
client.login(username="admin", password="password")
# test downloading all default importers
from shuup.importer.utils import get_importer, get_importer_choices
assert len(get_importer_choices())
for importer, name in get_importer_choices():
importer_cls = get_importer(importer)
if importer_cls.has_example_file():
import_response = client.get("{}?importer={}".format(import_url, importer_cls.identifier))
assert import_response.status_code == 200
assert "This importer provides example files" in import_response.content.decode("utf-8")
for example_file in importer_cls.example_files:
assert example_file.file_name in import_response.content.decode("utf-8")
# download file
download_url = "{}?importer={}&file_name={}".format(
reverse("shuup_admin:importer.download_example"),
importer_cls.identifier,
example_file.file_name
)
response = client.get(download_url)
if importer_cls.identifier == "dummy_file_importer":
assert response.status_code == 404
else:
assert response.status_code == 200
assert response._headers["content-type"] == ("Content-Type", str(example_file.content_type))
assert response._headers["content-disposition"] == ("Content-Disposition", 'attachment; filename=%s' % example_file.file_name)
if example_file.template_name:
from django.template.loader import get_template
template_file = get_template(example_file.template_name).template.filename
assert open(template_file, "r").read().strip() == response.content.decode("utf-8").strip()
else:
assert response.content
示例10: test_notify_on_company_created
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_notify_on_company_created(regular_user, allow_company_registration):
if "shuup.front.apps.customer_information" not in settings.INSTALLED_APPS:
pytest.skip("shuup.front.apps.customer_information required in installed apps")
if "shuup.notify" not in settings.INSTALLED_APPS:
pytest.skip("shuup.notify required in installed apps")
configuration.set(None, "allow_company_registration", allow_company_registration)
step = Step(
cond_op=StepConditionOperator.NONE,
actions=[
AddNotification({
"message": {"constant": "It Works. {{ customer_email }}"},
"message_identifier": {"constant": "company_created"},
})
],
next=StepNext.STOP
)
script = Script(
event_identifier=CompanyAccountCreated.identifier, name="Test Script", enabled=True, shop=get_default_shop())
script.set_steps([step])
script.save()
assert not Notification.objects.filter(identifier="company_created").exists()
assert get_person_contact(regular_user)
assert not get_company_contact(regular_user)
client = SmartClient()
client.login(username=REGULAR_USER_USERNAME, password=REGULAR_USER_PASSWORD)
company_edit_url = reverse("shuup:company_edit")
if allow_company_registration:
client.soup(company_edit_url)
data = _default_company_data()
data.update(_default_address_data("billing"))
data.update(_default_address_data("shipping"))
response, soup = client.response_and_soup(company_edit_url, data, "post")
assert response.status_code == 302
assert get_company_contact(regular_user)
assert Notification.objects.filter(identifier="company_created").count() == 1
notification = Notification.objects.filter(identifier="company_created").first()
assert notification
assert data["contact-email"] in notification.message
# New save should not add new notifications
response, soup = client.response_and_soup(company_edit_url, data, "post")
assert response.status_code == 302
assert Notification.objects.filter(identifier="company_created").count() == 1
script.delete()
else:
response = client.get(company_edit_url)
assert reverse("shuup:customer_edit") in response.url
assert Notification.objects.filter(identifier="company_created").count() == 0
示例11: test_get_installments_options_rest
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_get_installments_options_rest():
patch_cielo_request()
shop = get_default_shop()
c = SmartClient()
# method not allowed
response = c.post(INSTALLMENTS_PATH)
assert response.status_code == 405
# missing parameters
response = c.get(INSTALLMENTS_PATH)
assert response.status_code == 400
# no CieloConfig for shop
response = c.get(INSTALLMENTS_PATH, {"cc_brand": CieloCardBrand.Visa})
assert response.status_code == 400
CieloConfig.objects.create(shop=shop)
# basket not valid (no products and not payment/shipping methods)
response = c.get(INSTALLMENTS_PATH, {"cc_brand": CieloCardBrand.Visa})
assert response.status_code == 400
create_default_order_statuses()
populate_if_required()
set_current_theme('shuup.themes.classic_gray')
# configures the user basket
_configure_basket(c)
# only 1 installment, because no configurations were set on CieloConfig
response = c.get(INSTALLMENTS_PATH, {"cc_brand": CieloCardBrand.Visa})
assert response.status_code == 200
# should be the order total
order_total = PRODUCT_QTNTY * PRODUCT_PRICE
total_price_str = "{0}".format(format_money(shop.create_price(order_total)))
json_content = json.loads(response.content.decode("utf-8"))
assert len(json_content['installments']) == 1
assert json_content['installments'][0]['number'] == 1
assert total_price_str in json_content['installments'][0]['name']
示例12: test_serialize_data
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_serialize_data():
"""
Test contact dashboard views
"""
activate("en")
shop = factories.get_default_shop()
customer = factories.create_random_person("en")
user = factories.create_random_user("en")
user.set_password("1234")
user.save()
customer.user = user
customer.default_billing_address = factories.create_random_address()
customer.default_shipping_address = factories.create_random_address()
customer.save()
company = factories.create_random_company()
company.default_billing_address = factories.create_random_address()
company.default_shipping_address = factories.create_random_address()
company.save()
company.members.add(customer)
product = factories.create_product("p1", shop, factories.get_default_supplier())
for basket_customer in [customer, company]:
[factories.create_random_order(basket_customer, [product]) for order in range(3)]
client = SmartClient()
client.login(username=user.username, password="1234")
response = client.get(reverse("shuup:gdpr_customer_dashboard"))
assert response.status_code == 200
assert "My Data" in response.content.decode("utf-8")
response = client.post(reverse("shuup:gdpr_download_data"))
assert response._headers["content-disposition"][0] == "Content-Disposition"
assert response.status_code == 200
from shuup.tasks.models import Task, TaskType
from shuup.gdpr.models import GDPR_ANONYMIZE_TASK_TYPE_IDENTIFIER
response = client.post(reverse("shuup:gdpr_anonymize_account"))
assert response.status_code == 302
assert response.url.endswith(reverse("shuup:index"))
task_type = TaskType.objects.get(identifier=GDPR_ANONYMIZE_TASK_TYPE_IDENTIFIER, shop=shop)
assert Task.objects.get(type=task_type, shop=shop)
user.refresh_from_db()
assert user.is_active is False
refreshed_customer = PersonContact.objects.get(id=customer.id)
assert refreshed_customer.is_active is False
assert refreshed_customer.name == customer.name # nothing changed yet
示例13: test_get_installments_9x_with_simples_intereset
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_get_installments_9x_with_simples_intereset():
"""
Max 9 installs with SIMPLE intereset
interest_rate = 4.00%
"""
patch_cielo_request()
shop = get_default_shop()
create_default_order_statuses()
populate_if_required()
set_current_theme('shuup.themes.classic_gray')
c = SmartClient()
_configure_basket(c)
cielo_config = CieloConfig.objects.create(shop=shop,
max_installments=9,
installments_without_interest=3,
interest_type=InterestType.Simple,
interest_rate=Decimal(4.0))
SHIP_AMOUNT = Decimal(19.0)
shipping_method = get_default_shipping_method()
shipping_method.behavior_components.add(
FixedCostBehaviorComponent.objects.create(price_value=SHIP_AMOUNT)
)
order_total = (PRODUCT_QTNTY * PRODUCT_PRICE) + SHIP_AMOUNT
installment_choices = InstallmentContext(order_total, cielo_config).get_intallments_choices()
response = c.get(INSTALLMENTS_PATH, {"cc_brand": CieloCardBrand.Visa})
json_content = json.loads(response.content.decode("utf-8"))
assert len(json_content['installments']) == len(installment_choices)
for installment in range(len(installment_choices)):
total = format_money(shop.create_price(installment_choices[installment][2]))
installment_amount = format_money(shop.create_price(installment_choices[installment][1]))
assert json_content['installments'][installment]['number'] == installment+1
assert installment_amount in json_content['installments'][installment]['name']
assert total in json_content['installments'][installment]['name']
示例14: test_company_edit_form_links_company
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_company_edit_form_links_company(regular_user, allow_company_registration):
get_default_shop()
configuration.set(None, "allow_company_registration", allow_company_registration)
person = get_person_contact(regular_user)
assert not get_company_contact(regular_user)
client = SmartClient()
client.login(username=REGULAR_USER_USERNAME, password=REGULAR_USER_PASSWORD)
data = default_company_data()
data.update(default_address_data("billing"))
data.update(default_address_data("shipping"))
company_edit_url = reverse("shuup:company_edit")
if allow_company_registration:
soup = client.soup(company_edit_url)
response, soup = client.response_and_soup(company_edit_url, data, "post")
assert response.status_code == 302
assert get_company_contact(regular_user)
else:
response = client.get(company_edit_url)
assert response.status_code == 404
response = client.post(company_edit_url, data)
assert response.status_code == 404
示例15: test_refresh_transaction_view
# 需要导入模块: from shuup_tests.utils import SmartClient [as 别名]
# 或者: from shuup_tests.utils.SmartClient import get [as 别名]
def test_refresh_transaction_view(rf, admin_user):
initialize()
c = SmartClient()
default_product = get_default_product()
ORDER_TOTAL = PRODUCT_PRICE * 1
basket_path = reverse("shuup:basket")
c.post(basket_path, data={
"command": "add",
"product_id": default_product.pk,
"quantity": 1,
"supplier": get_default_supplier().pk
})
# Create methods
shipping_method = get_default_shipping_method()
processor = get_payment_provider()
payment_method = processor.create_service(
CIELO_SERVICE_CREDIT,
identifier="cielo_phase_cc",
shop=get_default_shop(),
name="credit card",
enabled=True,
tax_class=get_default_tax_class())
# Resolve paths
addresses_path = reverse("shuup:checkout", kwargs={"phase": "addresses"})
methods_path = reverse("shuup:checkout", kwargs={"phase": "methods"})
payment_path = reverse("shuup:checkout", kwargs={"phase": "payment"})
confirm_path = reverse("shuup:checkout", kwargs={"phase": "confirm"})
transaction_path = reverse("shuup:cielo_make_transaction")
# Phase: Addresses
addresses_soup = c.soup(addresses_path)
inputs = fill_address_inputs(addresses_soup, with_company=False)
c.post(addresses_path, data=inputs)
c.post(
methods_path,
data={
"payment_method": payment_method.pk,
"shipping_method": shipping_method.pk
}
)
c.get(confirm_path)
tid = uuid.uuid4().hex
transacao = get_in_progress_transaction(numero=1,
valor=decimal_to_int_cents(ORDER_TOTAL),
produto=CieloProduct.Credit,
bandeira=CieloCardBrand.Visa,
parcelas=CC_VISA_1X_INFO['installments'],
tid=tid)
transacao = get_approved_transaction(transacao)
with patch.object(CieloRequest, 'autorizar', return_value=transacao):
with patch.object(CieloRequest, 'consultar', return_value=transacao):
c.soup(payment_path)
c.post(transaction_path, CC_VISA_1X_INFO)
confirm_soup = c.soup(confirm_path)
c.post(confirm_path, data=extract_form_fields(confirm_soup))
order = Order.objects.filter(payment_method=payment_method).first()
process_payment_path = reverse("shuup:order_process_payment", kwargs={"pk": order.pk, "key": order.key})
process_payment_return_path = reverse("shuup:order_process_payment_return",kwargs={"pk": order.pk, "key": order.key})
c.get(process_payment_path)
c.get(process_payment_return_path)
order.refresh_from_db()
cielo_transaction = CieloTransaction.objects.get(order_transaction__order=order)
# transacao nao capturada
assert cielo_transaction.tid == tid
assert cielo_transaction.total_captured.value == Decimal()
view = load("shuup_cielo.admin.views.RefreshTransactionView").as_view()
request = apply_request_middleware(rf.post("/"), user=admin_user)
# request sem parametro - bad request
response = view(request)
assert response.status_code == 500
transacao = get_captured_transaction(transacao)
with patch.object(CieloRequest, 'consultar', return_value=transacao):
request = apply_request_middleware(rf.post("/", {"id":cielo_transaction.pk}), user=admin_user)
response = view(request)
assert response.status_code == 200
cielo_transaction.refresh_from_db()
assert cielo_transaction.total_captured_value == order.taxful_total_price_value