Passed
Push — dev ( 585a6c...674376 )
by Andreas
59s
created

tests.test_CMS.test_getconfig()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 0
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1 1
import pytest
2 1
from pathlib import Path
3 1
from CMS import getconfig, path_short
4 1
5
6
def test_getconfig_locale_not_null():
7
    """Проверка заполненности локали в конфиге."""
8
    assert getconfig()['settings']['locale'] is not None, 'Locale is not set'
9
10
11
@pytest.mark.parametrize('testpath, shortlen, expected',
12
                         [
13
                             ('test1/test2/test3', 1, 'test3'),
14
                             ('megapath/azaza/ololo', 2, 'azaza/ololo'),
15
                             ('t1/t2/t3', 3, 't1/t2/t3')
16
                             ])
17
def test_path_short(testpath, shortlen, expected):
18
    """Проверка сокращения путей."""
19
    assert path_short(testpath,
20
                      shortlen) == Path(expected), ('Short path is not valid')
21