Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Views tests don't test permissions #129

Open
AlexandrePalo opened this issue May 17, 2021 · 1 comment
Open

Views tests don't test permissions #129

AlexandrePalo opened this issue May 17, 2021 · 1 comment
Assignees

Comments

@AlexandrePalo
Copy link
Member

AlexandrePalo commented May 17, 2021

Currently, view based test (for instance BaseGeneralUsersViewsTestCase) don't test the permission.

It only test if a member in a certain group (3 are currently tested) have access or not :

In tests/tests_views.py, in the class BaseBorgiaViewsTestCase:

def setUp(self):
members_group = Group.objects.get(name=INTERNALS_GROUP_NAME)
externals_group = Group.objects.get(name=EXTERNALS_GROUP_NAME)
presidents_group = Group.objects.get(name=PRESIDENTS_GROUP_NAME)

Instead, the test should verifies that every user in a group with the proper permission (attribute permission_required in every view) does have access, and doesn't if not. Ie: permission are grouped based and not user based in Borgia even if possible with Django.

Permissions are set in the configuration thus it doesn't seems right to test group rather than permission directly. For instance the external group may have every permissions the president group have if Borgia is configured in this way.

@AlexandrePalo AlexandrePalo changed the title Views tests doesn't test permissions Views tests don't test permissions May 17, 2021
@AlexandrePalo
Copy link
Member Author

Work in progress on the branch moreTests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants