Use bare tokens: PAT_FOR_GITHUB replaces CREDENTIALS_FOR_GITHUB
The sync workflow reads secrets.PAT_FOR_GITHUB as clear text and parse_github_token and parse_gitea_token only check that the value is not empty. No secret is JSON any more; the wiki publisher follows. Update the tests, the guides, the README, PP-001 UC candidate 2 and the wiki pages with their Danish and Bahasa Malaysia translations. Task: MIL-002#5
This commit is contained in:
@@ -29,19 +29,15 @@ def b64(text: str) -> str:
|
||||
|
||||
|
||||
class TestParseGiteaToken:
|
||||
def test_accepts_bare_token(self):
|
||||
assert publish_wiki.parse_gitea_token(" abc ") == "abc"
|
||||
def test_returns_the_stripped_token(self):
|
||||
assert publish_wiki.parse_gitea_token(" abc \n") == "abc"
|
||||
|
||||
def test_accepts_json_object_and_string(self):
|
||||
assert publish_wiki.parse_gitea_token('{"GITEA_TOKEN": "abc"}') == "abc"
|
||||
assert publish_wiki.parse_gitea_token('"abc"') == "abc"
|
||||
|
||||
@pytest.mark.parametrize("raw", [None, "", " ", "{}", '{"GITEA_TOKEN": ""}', "[1]"])
|
||||
@pytest.mark.parametrize("raw", [None, "", " "])
|
||||
def test_rejects_missing_or_empty_token(self, raw):
|
||||
with pytest.raises(publish_wiki.WorkflowError) as caught:
|
||||
publish_wiki.parse_gitea_token(raw)
|
||||
assert caught.value.category == "configuration"
|
||||
assert "TOKEN_FOR_GITEA" in str(caught.value) or "wiki token" in str(caught.value)
|
||||
assert "No token for the wiki" in str(caught.value)
|
||||
|
||||
|
||||
class TestReadPages:
|
||||
|
||||
Reference in New Issue
Block a user