# retoor <retoor@molodetz.nl>

from playwright.sync_api import expect
from tests.conftest import BASE_URL


def test_profile_regenerate_api_key(alice):
    page, user = alice
    page.goto(f"{BASE_URL}/profile/{user['username']}", wait_until="domcontentloaded")
    resp = page.request.post(f"{BASE_URL}/profile/regenerate-api-key")
    assert resp.status == 200
    data = resp.json()
    assert "api_key" in data
    assert len(data["api_key"]) > 0
