Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add permissions tests

Mira Szewczyka57f7d1ca343
diff --git a/tests/dashboard/test_permissions.py b/tests/dashboard/test_permissions.py
index 5be35c27f4..4f7f70d177 100644
--- a/tests/dashboard/test_permissions.py
+++ b/tests/dashboard/test_permissions.py
@@ -998,12 +998,17 @@ def test_payment_index_view_cannot_be_accessed_without_permision(
response = staff_client.get(url)
assert response.status_code == 302
+
+def test_payment_index_view_can_be_accessed_with_permission(
+ staff_client, staff_user, permission_manage_plugins
+):
+ url = reverse("dashboard:payments-index")
staff_user.user_permissions.add(permission_manage_plugins)
response = staff_client.get(url)
assert response.status_code == 200
-def test_only_staff_user_with_proper_permission_can_update_payment_gateway(
+def test_staff_user_without_permission_cannot_update_payment_gateway(
staff_client, staff_user, permission_manage_plugins, settings
):
settings.PLUGINS = [
@@ -1015,6 +1020,15 @@ def test_only_staff_user_with_proper_permission_can_update_payment_gateway(
response = staff_client.get(url)
assert response.status_code == 302
+
+def test_only_staff_user_with_permission_can_update_payment_gateway(
+ staff_client, staff_user, permission_manage_plugins, settings
+):
+ settings.PLUGINS = [
+ "saleor.payment.gateways.braintree.plugin.BraintreeGatewayPlugin"
+ ]
+
+ url = reverse("dashboard:configure-payment", args=["Braintree"])
staff_user.user_permissions.add(permission_manage_plugins)
response = staff_client.get(url)
assert response.status_code == 200