Files
Wu Clan 0b95f2c61e Update asynccasbin to casbin async api (#199)
* Update asynccasbin to casbin async api

* remove pymysql dependency

* update the test-user test to admin
2023-08-08 17:27:20 +08:00

22 lines
688 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from starlette.testclient import TestClient
from backend.app.core.conf import settings
def test_login(client: TestClient) -> None:
data = {
'username': 'admin',
'password': '123456',
}
response = client.post(f'{settings.API_V1_STR}/auth/login', json=data)
assert response.status_code == 200
assert response.json()['data']['access_token_type'] == 'Bearer'
def test_logout(client: TestClient, token_headers: dict[str, str]) -> None:
response = client.post(f'{settings.API_V1_STR}/auth/logout', headers=token_headers)
assert response.status_code == 200
assert response.json()['code'] == 200