Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit 1b4cf69

Browse files
committed
test aud claim
1 parent 9275ecb commit 1b4cf69

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

tests/test_basic.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
from beacon_api.utils.db_load import parse_arguments, init_beacon_db, main
44
from beacon_api.conf.config import init_db_pool
55
from beacon_api.api.query import access_resolution
6-
from beacon_api.utils.validate import token_scheme_check
6+
from beacon_api.utils.validate import token_scheme_check, verify_aud_claim
77
from beacon_api.permissions.ga4gh import get_ga4gh_controlled, get_ga4gh_bona_fide
88
from .test_app import PARAMS
99
from testfixtures import TempDirectory
10+
from test.support import EnvironmentVarGuard
1011

1112

1213
def mock_token(bona_fide, permissions, auth):
@@ -106,6 +107,16 @@ def test_main_db(self, mock_init):
106107
main()
107108
mock_init.assert_called()
108109

110+
def test_aud_claim(self):
111+
"""Test aud claim function."""
112+
env = EnvironmentVarGuard()
113+
env.set('JWT_AUD', "aud1,aud2")
114+
result = verify_aud_claim()
115+
# Because it is false we expect it not to be parsed
116+
expected = (False, [])
117+
self.assertEqual(result, expected)
118+
env.unset('JWT_AUD')
119+
109120
def test_token_scheme_check_bad(self):
110121
"""Test token scheme no token."""
111122
# This might never happen, yet lets prepare for it

0 commit comments

Comments
 (0)