示例#1
0
def test_update_user(api_client: TestClient, api_routes: AppRoutes, token):
    update_data = {
        "id": 1,
        "fullName": "Updated Name",
        "email": "*****@*****.**",
        "group": "Home",
        "admin": True
    }
    response = api_client.put(api_routes.users_id(1),
                              headers=token,
                              json=update_data)

    assert response.status_code == 200
    assert json.loads(response.text).get("access_token")
示例#2
0
def test_init_superuser(api_client: TestClient, api_routes: AppRoutes, token,
                        default_user: UserOut):
    response = api_client.get(api_routes.users_id(1), headers=token)
    assert response.status_code == 200

    assert json.loads(response.text) == default_user.dict(by_alias=True)
示例#3
0
def test_delete_user(api_client: TestClient, api_routes: AppRoutes, token):
    response = api_client.delete(api_routes.users_id(2), headers=token)

    assert response.status_code == 200