about summary refs log tree commit diff
path: root/test/python/test_groups.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/python/test_groups.py')
-rw-r--r--test/python/test_groups.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/python/test_groups.py b/test/python/test_groups.py
index da7b5fa..66466de 100644
--- a/test/python/test_groups.py
+++ b/test/python/test_groups.py
@@ -1,5 +1,7 @@
-"""Mirrors tests/groups.rs. Needs a live MariaDB (SQL_URI); skips with a
-message rather than failing when none is reachable, same as test_species.py.
+"""Mirrors tests/groups.rs. Needs a live MariaDB (SQL_URI) and a valid
+token (every endpoint needs one now -- see docs/gn-auth.md); skips with
+a message rather than failing when either is missing, same as
+test_species.py.
 """
 
 import http.client
@@ -7,6 +9,7 @@ import json
 import socket
 import unittest
 
+from auth_helpers import TOKEN_ENV, auth_token
 from server_test_case import HOST, PORT, ServerTestCase
 
 
@@ -19,13 +22,18 @@ def database_reachable():
 
 
 class GroupsTest(ServerTestCase):
+    EXTRA_ENV = TOKEN_ENV
+
     def test_groups_returns_ok_with_bxd(self):
         if not database_reachable():
             self.skipTest("no database on 127.0.0.1:3306")
+        token = auth_token()
+        if not token:
+            self.skipTest("no token (see docs/gn-auth.md)")
 
         conn = http.client.HTTPConnection(HOST, int(PORT), timeout=10)
         try:
-            conn.request("GET", "/groups")
+            conn.request("GET", "/groups", headers={"Authorization": f"Bearer {token}"})
             response = conn.getresponse()
             body = response.read()
         finally: