From a3e6c0b046bdaf0e79fec14f940bfcd60173f15a Mon Sep 17 00:00:00 2001 From: timehexon Date: Mon, 2 Feb 2026 18:29:51 +0000 Subject: [PATCH] Fix failing API tests after namespace validation change - Add trailing slash to URI lookup in test_create_thread_with_uri to match how get_or_create_uri stores the URL - Create localhost namespace in TestAPIAuthenticatedEditing.setUp since api_create_thread no longer auto-creates namespaces --- remarkbox/tests/test_api_views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/remarkbox/tests/test_api_views.py b/remarkbox/tests/test_api_views.py index 58f037d..78d1512 100644 --- a/remarkbox/tests/test_api_views.py +++ b/remarkbox/tests/test_api_views.py @@ -114,7 +114,7 @@ class TestAPIAnonymousPosting(APIFunctionalTests): # Verify the URI record was created and linked from remarkbox.models.uri import get_uri_by_uri - uri = get_uri_by_uri(self.dbsession, "https://api-test.example.com/my-page") + uri = get_uri_by_uri(self.dbsession, "https://api-test.example.com/my-page/") self.assertIsNotNone(uri) self.assertEqual(str(uri.node.id), node_id) @@ -771,6 +771,12 @@ class TestAPIAuthenticatedEditing(APIFunctionalTests): APIFunctionalTests.setUpClass.__func__(cls) def setUp(self): + # Ensure the namespace exists so api_create_thread doesn't 404 + ns = get_or_create_namespace(self.dbsession, "localhost") + ns.api_access = True + self.dbsession.add(ns) + self.dbsession.flush() + self.test_user = get_or_create_user_by_email( self.dbsession, "api-edit@remarkbox.com" )