test_server.test_favicon()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
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
    path = 'this_is_a_path'
10
    actual_path = get_static_path(path)
11
    assert f'static/{path}' in actual_path.as_posix()
12
13
14
@pytest.mark.asyncio
15
async def test_favicon():
16
    actual = await graphinate.server.starlette.views.favicon(None)
17
18
    assert isinstance(actual, FileResponse)
19
    assert actual.media_type == 'image/png'
20
    assert 'src/graphinate/server/web/static/images/logo-128.png' in actual.path
21
22