-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_mssql.py
More file actions
43 lines (34 loc) · 1.34 KB
/
test_mssql.py
File metadata and controls
43 lines (34 loc) · 1.34 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
43
from fastapi.testclient import TestClient
import pytest
import os
no_sql = os.getenv("NO_SQL_SERVER", "0") == "1"
@pytest.mark.skipif(no_sql, reason="No SQL Server available")
def test_simple_department(client: TestClient):
response = client.get(
"/api/v1/mssql/mssql_department?format=json&limit=50",
)
assert response.status_code == 200
departments = response.json()
assert len(departments) == 16
@pytest.mark.skipif(no_sql, reason="No SQL Server available")
def test_filter_group_name(client: TestClient):
response = client.get(
"/api/v1/mssql/mssql_department?format=json&limit=100&GroupName=Research%20and%20Development",
)
assert response.status_code == 200
tables = response.json()
assert len(tables) == 3
@pytest.mark.skipif(no_sql, reason="No SQL Server available")
def test_filter_offset(client: TestClient):
response = client.get(
"/api/v1/mssql/mssql_department?format=json&limit=100&offset=10",
)
assert response.status_code == 200
tables = response.json()
assert len(tables) == 6
@pytest.mark.skipif(no_sql, reason="No SQL Server available")
def test_metadata_detail(client: TestClient):
response = client.get(
"/api/v1/mssql/mssql_department/metadata_detail",
)
assert response.status_code == 200