test_server.test_get_static_path()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nop 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
    # 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