def test_get_category_with_valid_id(self, client): response = get(client, '/categories/1') assert response.status_code == 200 assert response.get_json()['id'] == 1 assert response.get_json()['name'] == 'Spring' assert response.get_json()['description'] == 'Warm' assert response.get_json()['image_url'] == 'https://vn.got-it.ai/'
def test_get_item_with_valid_id(self, client): response = get(client, '/categories/1/items/1') assert response.status_code == 200 assert response.get_json()['id'] == 1 assert response.get_json()['description'] == 'Plant' assert response.get_json()['image_url'] == 'https://vn.got-it.ai/' assert response.get_json()['category_id'] == 1 assert response.get_json()['author']['id'] == 1 assert response.get_json()['author']['name'] == 'Duong Le'
def test_get_category_with_invalid_id(self, client): response = get(client, '/categories/5') assert response.status_code == 404
def test_get_list_category_with_invalid_parameters(self, client): response = get(client, '/categories?offset=a') assert response.status_code == 400 response = get(client, '/categories?limit=-1') assert response.status_code == 400
def test_get_list_category_with_valid_parameters(self, client): response = get(client, '/categories?offset=2&limit=2') assert response.status_code == 200 assert response.get_json()['total_items'] == 4 assert len(response.get_json()['items']) == 2
def test_get_user_with_valid_token(self, client): access_token = get_access_token(client) response = get(client, '/users/me', access_token) assert response.status_code == 200 assert response.get_json()['id'] == 1 assert response.get_json()['name'] == 'Duong Le'
def test_get_item_with_invalid_id(self, client): response = get(client, '/categories/1/items/10') assert response.status_code == 404