test_server   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 15
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A test_get_static_path() 0 9 1
A test_favicon() 0 9 1
1
import pytest
2
from starlette.responses import FileResponse
3
4
import graphinate.server.starlette.views
5
from graphinate.server.web import get_static_path
6
7
8
def test_get_static_path():
9
    # Arrange
10
    path = 'this_is_a_path'
11
12
    # Act
13
    actual_path = get_static_path(path)
14
15
    # Assert
16
    assert f'static/{path}' in actual_path.as_posix()
17
18
19
@pytest.mark.asyncio
20
async def test_favicon():
21
    # Act
22
    actual = graphinate.server.starlette.views.favicon(None)
23
24
    # Assert
25
    assert isinstance(actual, FileResponse)
26
    assert actual.media_type == 'image/png'
27
    assert 'src/graphinate/server/web/static/images/logo-128.png' in actual.path
28