chore: prepare release v0.4.0
This commit is contained in:
+24
-11
@@ -32,7 +32,11 @@ class TestAdminLogin:
|
||||
token = _csrf_from_body(resp.text)
|
||||
resp = admin_client.post(
|
||||
"/admin/login",
|
||||
data={"username": "admin", "password": "secret", "_csrf": token},
|
||||
data={
|
||||
"username": "admin",
|
||||
"password": "volumen-test-password",
|
||||
"_csrf": token,
|
||||
},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert resp.status_code in (302, 307, 303)
|
||||
@@ -62,7 +66,11 @@ def _login(client: TestClient) -> str:
|
||||
token = _csrf_from_body(resp.text)
|
||||
client.post(
|
||||
"/admin/login",
|
||||
data={"username": "admin", "password": "secret", "_csrf": token},
|
||||
data={
|
||||
"username": "admin",
|
||||
"password": "volumen-test-password",
|
||||
"_csrf": token,
|
||||
},
|
||||
follow_redirects=True,
|
||||
)
|
||||
return token
|
||||
@@ -264,16 +272,16 @@ class TestSettings:
|
||||
"/admin/settings/password",
|
||||
data={
|
||||
"_csrf": token,
|
||||
"current_password": "secret",
|
||||
"new_password": "brand-new",
|
||||
"current_password": "volumen-test-password",
|
||||
"new_password": "volumen-brand-new-pw",
|
||||
},
|
||||
)
|
||||
assert "Password updated" in resp.text
|
||||
|
||||
users_path = str(admin_config_dir / "users.toml")
|
||||
fresh = Users(path=users_path)
|
||||
assert fresh.authenticate("admin", "secret") is None
|
||||
assert fresh.authenticate("admin", "brand-new") is not None
|
||||
assert fresh.authenticate("admin", "volumen-test-password") is None
|
||||
assert fresh.authenticate("admin", "volumen-brand-new-pw") is not None
|
||||
|
||||
def test_change_password_wrong_current(self, admin_client: TestClient) -> None:
|
||||
_login(admin_client)
|
||||
@@ -339,7 +347,7 @@ class TestFediverseSettings:
|
||||
"/admin/settings/fediverse",
|
||||
data={"_csrf": token, "fediverse_creator": "@user@example.com"},
|
||||
)
|
||||
assert "updated" in resp.text.lower() or "updated" in resp.text.lower()
|
||||
assert "updated" in resp.text.lower()
|
||||
|
||||
def test_change_fediverse_creator_invalid(self, admin_client: TestClient) -> None:
|
||||
_login(admin_client)
|
||||
@@ -359,9 +367,14 @@ class TestUserManagement:
|
||||
token = _csrf_from_body(resp.text)
|
||||
resp = admin_client.post(
|
||||
"/admin/settings/users",
|
||||
data={"_csrf": token, "username": "editor", "password": "pw12345", "role": "author"},
|
||||
data={
|
||||
"_csrf": token,
|
||||
"username": "editor",
|
||||
"password": "editor-test-pw",
|
||||
"role": "author",
|
||||
},
|
||||
)
|
||||
assert "User added" in resp.text or "added" in resp.text.lower()
|
||||
assert "User added" in resp.text
|
||||
|
||||
users_path = str(admin_config_dir / "users.toml")
|
||||
users = Users(path=users_path)
|
||||
@@ -373,7 +386,7 @@ class TestUserManagement:
|
||||
token = _csrf_from_body(resp.text)
|
||||
admin_client.post(
|
||||
"/admin/settings/users",
|
||||
data={"_csrf": token, "username": "editor2", "password": "pw12345"},
|
||||
data={"_csrf": token, "username": "editor2", "password": "editor-test-pw"},
|
||||
)
|
||||
|
||||
# Logout
|
||||
@@ -382,7 +395,7 @@ class TestUserManagement:
|
||||
admin_client.post("/admin/logout", data={"_csrf": token})
|
||||
|
||||
# Login as new user
|
||||
_login_as(admin_client, "editor2", "pw12345")
|
||||
_login_as(admin_client, "editor2", "editor-test-pw")
|
||||
resp = admin_client.get("/admin/")
|
||||
assert resp.status_code == 200
|
||||
|
||||
|
||||
Reference in New Issue
Block a user