mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
Allow auth token to be passed as a URL param
This commit is contained in:
1 parent
dd6ca38035
commit
f4b67f2e59
2 files changed
+35
-2
No files matched your search
@@ -291,6 +291,26 @@ class TestUserLogin:
|
||||
assert response.status_code == status_code
|
||||
assert "access_token" not in response.json()
|
||||
|
||||
async def test_user_can_use_token_as_url_param(
|
||||
self,
|
||||
app: FastAPI,
|
||||
unauthorized_client: AsyncClient,
|
||||
test_user: User,
|
||||
config: Config
|
||||
) -> None:
|
||||
|
||||
credentials = {
|
||||
"username": test_user.username,
|
||||
"password": "user1_password",
|
||||
}
|
||||
|
||||
response = await unauthorized_client.post(app.url_path_for("authenticate"), json=credentials)
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
token = response.json().get("access_token")
|
||||
|
||||
response = await unauthorized_client.get(app.url_path_for("get_projects"), params={"token": token})
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
|
||||
|
||||
class TestUserMe:
|
||||
|
||||
|
||||
Reference in new issue
Block a user