Ejemplo n.º 1
0
    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')
Ejemplo n.º 2
0
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": []
    }
Ejemplo n.º 3
0
def test_read_items():
    response = client.get("/items")
    assert response.status_code == 200
Ejemplo n.º 4
0
 def test_unknown_uid_retrieve(self):
     response = client.get(f"/v1/users/99026463829")
     assert response.status_code == HTTPStatus.NOT_FOUND
Ejemplo n.º 5
0
    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
Ejemplo n.º 6
0
def test_read_users():
    token = test_user_authenticate()
    response = client.get("/users",
                          headers={"Authorization": f"Bearer {token}"})
    assert response.status_code == 200
Ejemplo n.º 7
0
 def test_retrieve(self):
     response = client.get(f"/")
     assert response.status_code == HTTPStatus.OK