Completed
Push — master ( 3fd1c7...524f47 )
by Chris
01:08
created

test_path_hierarchy()   A

Complexity

Conditions 4

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 7
rs 9.2
1
from uuid import uuid1
2
import json
3
4
import pytest
5
6
from flask_jsondash.data_utils import filetree
7
8
9
def test_path_hierarchy(tmpdir):
10
    uid = uuid1()
11
    tmpfile = tmpdir.mkdir('{}'.format(uid))
12
    data = filetree.path_hierarchy(tmpfile.strpath)
13
    assert json.dumps(data)
14
    for key in ['type', 'name', 'path']:
15
        assert key in data
16
17
18
def test_path_hierarchy_invalid_path(tmpdir):
19
    with pytest.raises(OSError):
20
        filetree.path_hierarchy('invalid-path')
21