Reorder and label test cases

This commit takes the existing test cases, removes duplicates, and tries
to add a human-readable comment explaining what each one is testing.
This commit is contained in:
Chris Hill-Scott
2022-06-06 15:07:53 +01:00
parent ea9c7e6102
commit 30eebf3586

View File

@@ -6,15 +6,25 @@ from app.utils.user import user_has_permissions
@pytest.mark.parametrize('permissions', (
pytest.param(
['send_messages'],
marks=pytest.mark.xfail(raises=Forbidden),
),
['manage_service'],
['send_messages', 'manage_service'],
['manage_templates', 'manage_service'],
['manage_service', 'manage_templates'],
[],
pytest.param([
# Route has a permission which the user doesnt have
'send_messages'
], marks=pytest.mark.xfail(raises=Forbidden)),
[
# Route has one of the permissions which the user has
'manage_service'
],
[
# Route has more than one of the permissions which the user has
'manage_templates', 'manage_service'
],
[
# Route has one of the permissions which the user has, and one they do not
'manage_service', 'send_messages',
],
[
# Route has no specific permissions required
],
))
def test_permissions(
client_request,