-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#486] New test for field_based_authorization
- Loading branch information
1 parent
1771338
commit 579e68a
Showing
1 changed file
with
38 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -766,3 +766,41 @@ def test_invalid_permissions_mode_not_valid(self): | |
) | ||
self.assertEqual(TokenAuth.objects.count(), 0) | ||
self.assertEqual(Permission.objects.count(), 0) | ||
|
||
def test_invalid_permissions_field_based_authorization(self): | ||
object_source = { | ||
"tokenauth_config_enable": True, | ||
"tokenauth": { | ||
"items": [ | ||
{ | ||
"identifier": "token-1", | ||
"token": "ba9d233e95e04c4a8a661a27daffe7c9bd019067", | ||
"contact_person": "Person 1", | ||
"email": "[email protected]", | ||
"organization": "Organization 1", | ||
"application": "Application 1", | ||
"administration": "Administration 1", | ||
"permissions": [ | ||
{ | ||
"object_type": "3a82fb7f-fc9b-4104-9804-993f639d6d0d", | ||
"mode": "read_and_write", | ||
"use_fields": True, | ||
"fields": { | ||
"1": [ | ||
"record__data__leeftijd", | ||
"record__data__kiemjaar", | ||
] | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
} | ||
with self.assertRaises(ConfigurationRunFailed) as command_error: | ||
execute_single_step(TokenAuthConfigurationStep, object_source=object_source) | ||
|
||
self.assertTrue( | ||
"Validation error(s) during instance cleaning" | ||
in str(command_error.exception) | ||
) |