def test_retrieve_order_by_sessions(self): response = client.get(f"/v1/users/{self.active_uid}") assert response.status_code == HTTPStatus.OK response = response.json() sessions = response.get('sessions') assert len(sessions) == 2 assert sessions[0].get('created_dt') > sessions[1].get('created_dt')
def test_read_user(): user = client.get response = client.get("/users/1") assert response.status_code == 200 assert response.json() == { "username": "******", "email": "*****@*****.**", "id": 1, "is_active": True, "items": [] }
def test_read_items(): response = client.get("/items") assert response.status_code == 200
def test_unknown_uid_retrieve(self): response = client.get(f"/v1/users/99026463829") assert response.status_code == HTTPStatus.NOT_FOUND
def test_leave_retrieve(self): response = client.get(f"/v1/users/{self.leave_uid}") assert response.status_code == HTTPStatus.OK response = response.json() assert response.get('leave_dt') is not None
def test_read_users(): token = test_user_authenticate() response = client.get("/users", headers={"Authorization": f"Bearer {token}"}) assert response.status_code == 200
def test_retrieve(self): response = client.get(f"/") assert response.status_code == HTTPStatus.OK