mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-06 01:40:19 +00:00
test(openwebui): pin what a bare restart brings back
Open WebUI runs with persistent config off, so the environment is authoritative on every start and whatever the connection filter renders is the state the container comes back with, not only what a deploy produces. The filter already carried the group grant in that environment, but nothing asserted it: without the grant travelling there, a restart would restore a disabled connection that waits for the next deploy. The README described exactly that outage as the current behaviour, which stopped being true once the grant moved into the environment, so it is corrected rather than left to mislead the next reader. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9166e98405
commit
f52315850c
2 files changed
+80
-7
No files matched your search
@@ -40,6 +40,78 @@ class TestMcpToolServerConnections(unittest.TestCase):
|
||||
self.assertEqual(entry["config"]["access_grants"], [])
|
||||
self.assertEqual(entry["info"]["id"], "web-app-homeassistant")
|
||||
|
||||
def test_a_known_group_enables_the_entry_with_exactly_that_grant(self):
|
||||
"""This is what survives a restart.
|
||||
|
||||
``ENABLE_PERSISTENT_CONFIG=false`` makes the env authoritative on every
|
||||
start, so whatever this filter renders is the state Open WebUI comes
|
||||
back with. Only when the grant travels in the env does a bare container
|
||||
restart restore a served, correctly scoped connection instead of a
|
||||
disabled one that waits for the next deploy.
|
||||
"""
|
||||
result = mcp_tool_server_connections(
|
||||
[
|
||||
{
|
||||
"id": "web-app-homeassistant",
|
||||
"url": "http://homeassistant:8123/api/mcp",
|
||||
"token": "secret",
|
||||
"auth": "bearer_token",
|
||||
}
|
||||
],
|
||||
{"web-app-homeassistant": "grp-42"},
|
||||
)
|
||||
|
||||
entry = result[0]
|
||||
self.assertTrue(entry["config"]["enable"])
|
||||
self.assertEqual(
|
||||
entry["config"]["access_grants"],
|
||||
[
|
||||
{
|
||||
"principal_type": "group",
|
||||
"principal_id": "grp-42",
|
||||
"permission": "read",
|
||||
}
|
||||
],
|
||||
)
|
||||
|
||||
def test_another_providers_group_does_not_enable_this_one(self):
|
||||
result = mcp_tool_server_connections(
|
||||
[
|
||||
{
|
||||
"id": "web-app-homeassistant",
|
||||
"url": "http://homeassistant:8123/api/mcp",
|
||||
"token": "secret",
|
||||
"auth": "bearer_token",
|
||||
}
|
||||
],
|
||||
{"web-app-gitea": "grp-42"},
|
||||
)
|
||||
|
||||
entry = result[0]
|
||||
self.assertFalse(
|
||||
entry["config"]["enable"],
|
||||
"a group id belonging to a different provider must not open this "
|
||||
"one; the grant is per application, not per deployment",
|
||||
)
|
||||
self.assertEqual(entry["config"]["access_grants"], [])
|
||||
|
||||
def test_an_empty_group_id_counts_as_unknown(self):
|
||||
result = mcp_tool_server_connections(
|
||||
[
|
||||
{
|
||||
"id": "web-app-homeassistant",
|
||||
"url": "http://homeassistant:8123/api/mcp",
|
||||
"token": "secret",
|
||||
"auth": "bearer_token",
|
||||
}
|
||||
],
|
||||
{"web-app-homeassistant": " "},
|
||||
)
|
||||
|
||||
entry = result[0]
|
||||
self.assertFalse(entry["config"]["enable"])
|
||||
self.assertEqual(entry["config"]["access_grants"], [])
|
||||
|
||||
def test_no_connection_is_offered_to_every_signed_in_user(self):
|
||||
result = mcp_tool_server_connections(
|
||||
[
|
||||
|
||||
Reference in new issue
Block a user