-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor tests and get_permission logic from review
- Loading branch information
1 parent
c6879fb
commit d169e96
Showing
2 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -376,6 +376,7 @@ def test_regular_user_has_no_destroy_permission(self): | |
|
||
@pytest.mark.django_db | ||
def test_free_plan_has_only_fixed_projects_permission(): | ||
# Given | ||
organisation = Organisation.objects.create(name="Test organisation") | ||
|
||
user = FFAdminUser.objects.create(email="[email protected]") | ||
|
@@ -387,13 +388,15 @@ def test_free_plan_has_only_fixed_projects_permission(): | |
|
||
project_permissions = ProjectPermissions() | ||
|
||
mock_view.action = "create" | ||
mock_view.detail = False | ||
mock_request.data = {"name": "Test", "organisation": organisation.id} | ||
mock_request.user = user | ||
mock_view = mock.MagicMock(action="create", detail=False) | ||
mock_request = mock.MagicMock( | ||
data={"name": "Test", "organisation": organisation.id}, user=user | ||
) | ||
|
||
# When | ||
for i in range(MAX_PROJECTS_IN_FREE_PLAN): | ||
assert project_permissions.has_permission(mock_request, mock_view) | ||
Project.objects.create(name=f"Test project{i}", organisation=organisation) | ||
|
||
# Then - free projects limit should be exhausted | ||
assert not project_permissions.has_permission(mock_request, mock_view) |