mirror of
https://github.com/ansible/awx.git
synced 2026-03-15 07:57:29 -02:30
validate token scope
This commit is contained in:
14
awx/main/tests/unit/api/serializers/test_token_serializer.py
Normal file
14
awx/main/tests/unit/api/serializers/test_token_serializer.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import pytest
|
||||
|
||||
from awx.api.serializers import OAuth2TokenSerializer
|
||||
|
||||
|
||||
@pytest.mark.parametrize('scope, expect', [
|
||||
('', False),
|
||||
('read', True),
|
||||
('read read', False),
|
||||
('write read', True),
|
||||
('read rainbow', False)
|
||||
])
|
||||
def test_invalid_scopes(scope, expect):
|
||||
assert OAuth2TokenSerializer()._is_valid_scope(scope) is expect
|
||||
Reference in New Issue
Block a user