[FEAT] cleanup GET /wallet endpoint, add wallet api routes (#1932)
* [FEAT] cleanup GET /wallet endpoint, add wallet api route this removes the functionalitiy to create accounts and wallets via the GET /wallet endpoint in generic.py it add endpoints inside the api.py for it and the frontend is modified to use the api endpoints this also simplifies for the `feat/login` for the route. * remove stale generic tests and add api tests * bug wrong endpoint create account * vlad nitpick * added checkif deleted is 404 * reload after renaming wallet * another iteration with vlad * create new wallet if it none exist * fix delete refresh * formatting
This commit is contained in:
@@ -7,35 +7,6 @@ async def test_core_views_generic(client):
|
||||
assert response.status_code == 200, f"{response.url} {response.status_code}"
|
||||
|
||||
|
||||
# check GET /wallet: wallet info
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_wallet(client):
|
||||
response = await client.get("wallet")
|
||||
# redirect not modified
|
||||
assert response.status_code == 307, f"{response.url} {response.status_code}"
|
||||
|
||||
|
||||
# check GET /wallet: do not allow redirects, expect code 307
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_wallet_no_redirect(client):
|
||||
response = await client.get("wallet", follow_redirects=False)
|
||||
assert response.status_code == 307, f"{response.url} {response.status_code}"
|
||||
|
||||
# determine the next redirect location
|
||||
request = client.build_request("GET", "wallet")
|
||||
i = 0
|
||||
while request is not None:
|
||||
response = await client.send(request)
|
||||
request = response.next_request
|
||||
if i == 0:
|
||||
# first redirect
|
||||
assert response.status_code == 307, f"{response.url} {response.status_code}"
|
||||
elif i == 1:
|
||||
# then get the actual page
|
||||
assert response.status_code == 200, f"{response.url} {response.status_code}"
|
||||
i += 1
|
||||
|
||||
|
||||
# check GET /wallet: wrong user, expect 400
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_wallet_with_nonexistent_user(client):
|
||||
@@ -43,27 +14,6 @@ async def test_get_wallet_with_nonexistent_user(client):
|
||||
assert response.status_code == 400, f"{response.url} {response.status_code}"
|
||||
|
||||
|
||||
# check GET /wallet: with user
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_wallet_with_user(client, to_user):
|
||||
response = await client.get("wallet", params={"usr": to_user.id})
|
||||
assert response.status_code == 307, f"{response.url} {response.status_code}"
|
||||
|
||||
# determine the next redirect location
|
||||
request = client.build_request("GET", "wallet", params={"usr": to_user.id})
|
||||
i = 0
|
||||
while request is not None:
|
||||
response = await client.send(request)
|
||||
request = response.next_request
|
||||
if i == 0:
|
||||
# first redirect
|
||||
assert response.status_code == 307, f"{response.url} {response.status_code}"
|
||||
elif i == 1:
|
||||
# then get the actual page
|
||||
assert response.status_code == 200, f"{response.url} {response.status_code}"
|
||||
i += 1
|
||||
|
||||
|
||||
# check GET /wallet: wallet and user
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_wallet_with_user_and_wallet(client, to_user, to_wallet):
|
||||
@@ -89,7 +39,7 @@ async def test_get_extensions(client, to_user):
|
||||
|
||||
# check GET /extensions: extensions list wrong user, expect 400
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_extensions_wrong_user(client, to_user):
|
||||
async def test_get_extensions_wrong_user(client):
|
||||
response = await client.get("extensions", params={"usr": "1"})
|
||||
assert response.status_code == 400, f"{response.url} {response.status_code}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user