diff options
Diffstat (limited to 'test/python/auth_helpers.py')
| -rw-r--r-- | test/python/auth_helpers.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/test/python/auth_helpers.py b/test/python/auth_helpers.py index 091c823..c16a7dd 100644 --- a/test/python/auth_helpers.py +++ b/test/python/auth_helpers.py @@ -16,10 +16,11 @@ from server_test_case import HOST, PORT AUTH_SERVER_URL = os.environ.get("AUTH_SERVER_URL", "http://127.0.0.1:8081/") -# Every endpoint needs a token now (see docs/gn-auth.md) -- a test class -# that calls auth_token() needs its server started with this so it can -# self-issue one. -TOKEN_ENV = {"GENENETWORK4_DEV_MODE": "true", "GENENETWORK4_BIND": "127.0.0.1"} +# Every endpoint needs a token (see docs/gn-auth.md), and a test server +# issues one to a local caller with no configuration at all (POST +# /get-test-token is not tied to a mode). Kept as an empty environment so +# the test classes that set `EXTRA_ENV = TOKEN_ENV` need no change. +TOKEN_ENV = {} def auth_server_reachable(): @@ -36,14 +37,12 @@ def auth_server_reachable(): def auth_token(): - """A bearer token to use against the already-running test server - (started with TOKEN_ENV). Tries POST /get-test-token first -- this - just works once the server was started with TOKEN_ENV, no - externally managed token needed -- falling back to the - GN4_TEST_AUTH_TOKEN env var (see docs/gn-auth.md) for a gn-auth - setup that doesn't want dev mode on even for tests. Returns None, - rather than raising, if neither produces a token; callers should - skipTest() in that case. + """A bearer token to use against the already-running test server. + Tries POST /get-test-token first -- the test client is local, so + this just works with a reachable gn-auth, no externally managed + token needed -- falling back to the GN4_TEST_AUTH_TOKEN env var (see + docs/gn-auth.md). Returns None, rather than raising, if neither + produces a token; callers should skipTest() in that case. """ conn = http.client.HTTPConnection(HOST, int(PORT), timeout=10) try: |
