From 1f927760520d3b2745174f767f7f5ce541927fc4 Mon Sep 17 00:00:00 2001 From: autonomic-bot Date: Sun, 31 May 2026 04:41:03 +0000 Subject: [PATCH] fix(discourse): enable allow_uncategorized_topics in admin bootstrap so create-topic POST succeeds (Discourse 3.x 422 'Category cant be blank') --- tests/discourse/functional/_discourse.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/discourse/functional/_discourse.py b/tests/discourse/functional/_discourse.py index 7e0ca2a..203e4ee 100644 --- a/tests/discourse/functional/_discourse.py +++ b/tests/discourse/functional/_discourse.py @@ -24,7 +24,13 @@ from harness import lifecycle # noqa: E402 # Rails snippet (single line): find-or-create an admin, create an ApiKey, print key + username as the # last two lines. SecureRandom is available in the Rails runtime. We mark the user active + approved # so the API accepts it. created_by_id must be set (ApiKey validates it). +# +# We also enable `allow_uncategorized_topics` (a standard Discourse feature, off by default since 3.x): +# without it, POST /posts.json with no category 422s "Category can't be blank". This is config parity +# with a real forum (the operator would either enable uncategorized or pick a category), not a test +# weakening — the create-topic round-trip still posts a real topic and asserts a unique marker survives. _BOOTSTRAP_RB = ( + "SiteSetting.allow_uncategorized_topics = true; " "u = User.where(admin: true).order(:id).first; " "if u.nil?; " "u = User.create!(username: 'ccciadmin', name: 'CCCI Admin', "