Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(auth): take the internal API auth secret tests off the database (#100025)

posthog[bot]67d920431ba6
diff --git a/posthog/test/test_internal_api_auth.py b/posthog/test/test_internal_api_auth.py
index c45e09307c1c..0755f649eb52 100644
--- a/posthog/test/test_internal_api_auth.py
+++ b/posthog/test/test_internal_api_auth.py
@@ -3,7 +3,7 @@ from types import SimpleNamespace
from posthog.test.base import APIBaseTest
from unittest.mock import MagicMock, patch
-from django.test import RequestFactory, override_settings
+from django.test import RequestFactory, SimpleTestCase, override_settings
from parameterized import parameterized
from rest_framework.exceptions import AuthenticationFailed
@@ -13,9 +13,8 @@ from posthog.auth import InternalAPIAuthentication
from posthog.settings import LOCAL_DEV_INTERNAL_API_SECRET
-class TestInternalAPIAuth(APIBaseTest):
+class TestInternalAPIAuthWithoutDatabase(SimpleTestCase):
def setUp(self):
- super().setUp()
self.factory = RequestFactory()
self.authentication = InternalAPIAuthentication()
@@ -95,6 +94,13 @@ class TestInternalAPIAuth(APIBaseTest):
request = self.factory.get("/internal/endpoint")
self.assertEqual(self.authentication.authenticate_header(request), "InternalApiSecret")
+
+class TestInternalAPIAuth(APIBaseTest):
+ def setUp(self):
+ super().setUp()
+ self.factory = RequestFactory()
+ self.authentication = InternalAPIAuthentication()
+
@override_settings(INTERNAL_API_SECRET="test-secret-123")
def test_sets_org_and_team_from_team_id_route_param(self):
request = Request(