Repository navigation
Expand file tree
/
Copy pathtest_server.py
More file actions
42 lines (29 loc) · 1.39 KB
/
Copy pathtest_server.py
File metadata and controls
42 lines (29 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from http import HTTPStatus
import pytest
from shared.utils.config import make_api_client, put_method
@pytest.mark.usefixtures("restore_db_per_class")
class TestGetServer:
def test_can_retrieve_about_unauthenticated(self):
with make_api_client(user=None, password=None) as api_client:
(data, response) = api_client.server_api.retrieve_about()
assert response.status == HTTPStatus.OK
assert data.version
def test_can_retrieve_formats(self, admin_user: str):
with make_api_client(admin_user) as api_client:
(data, response) = api_client.server_api.retrieve_annotation_formats()
assert response.status == HTTPStatus.OK
assert len(data.importers) != 0
assert len(data.exporters) != 0
def test_method_not_allowed_for_existing_route(self, admin_user: str):
response = put_method(admin_user, "server/annotation/formats", data=None)
assert response.status_code == HTTPStatus.METHOD_NOT_ALLOWED
@pytest.mark.usefixtures("restore_db_per_class")
class TestGetSchema:
def test_can_get_schema_unauthenticated(self):
with make_api_client(user=None, password=None) as api_client:
(data, response) = api_client.schema_api.retrieve()
assert response.status == HTTPStatus.OK
assert data