test_openapi   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A test_datatype_matching() 0 30 1
A test_openapi_spec_generation() 0 2 1
1
from yfrake.openapi.generator import generate_openapi_spec
2
from yfrake.openapi.utils import get_openapi_datatype
3
4
5
def test_openapi_spec_generation():
6
    generate_openapi_spec()
7
8
9
def test_datatype_matching():
10
    result = get_openapi_datatype(str)
11
    assert result == 'string'
12
    result = get_openapi_datatype(str())
13
    assert result == 'string'
14
15
    result = get_openapi_datatype(int)
16
    assert result == 'integer'
17
    result = get_openapi_datatype(int())
18
    assert result == 'integer'
19
20
    result = get_openapi_datatype(bool)
21
    assert result == 'boolean'
22
    result = get_openapi_datatype(bool())
23
    assert result == 'boolean'
24
25
    result = get_openapi_datatype(list)
26
    assert result == 'array'
27
    result = get_openapi_datatype(list())
28
    assert result == 'array'
29
30
    result = get_openapi_datatype(dict)
31
    assert result == 'object'
32
    result = get_openapi_datatype(dict())
33
    assert result == 'object'
34
35
    result = get_openapi_datatype(float)
36
    assert result == 'number'
37
    result = get_openapi_datatype(float())
38
    assert result == 'number'
39