Align the project baseline with the latest admin interface styling and layout structure while documenting setup and usage updates in README.
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
from tests.helpers import register_verify_login
|
|
|
|
|
|
def test_me_endpoint(client):
|
|
headers = register_verify_login(client, "me@example.com", "Valid123")
|
|
response = client.get("/api/v1/users/me", headers=headers)
|
|
assert response.status_code == 200
|
|
assert response.json()["user"]["email"] == "me@example.com"
|
|
|
|
|
|
def test_patch_me_updates_display_name(client):
|
|
headers = register_verify_login(client, "display@example.com", "Valid123")
|
|
response = client.patch(
|
|
"/api/v1/users/me",
|
|
headers=headers,
|
|
json={"display_name": "Updated Name"},
|
|
)
|
|
assert response.status_code == 200
|
|
assert response.json()["profile"]["display_name"] == "Updated Name"
|
|
|
|
|
|
def test_change_password_rejects_invalid_current(client):
|
|
headers = register_verify_login(client, "pwd@example.com", "Valid123")
|
|
response = client.post(
|
|
"/api/v1/users/me/password",
|
|
headers=headers,
|
|
json={"current_password": "Wrong123", "new_password": "NewValid1"},
|
|
)
|
|
assert response.status_code == 400
|
|
assert response.json()["detail"] == "INVALID_CURRENT_PASSWORD"
|