示例#1
0
def test_process_directory(directory_of_yaml):
    assert File().process_directory(directory_of_yaml) == [{
        'key1': 'value1'
    }, {
        'key2': 'value2'
    }]
示例#2
0
def test_glob_yaml_file(tmpdir):
    temp_dir = tmpdir.mkdir("test_dir")
    temp_file = temp_dir.join("file.yaml")
    temp_file.write("")
    assert File()._glob_yaml_file(temp_dir) == list(temp_dir.listdir())
示例#3
0
def test_process_file(valid_yaml_file):
    assert File().process_file(valid_yaml_file) == [{'key': 'value'}]
示例#4
0
def test_parse_yaml(valid_yaml_file):
    assert File().parse_yaml(open(valid_yaml_file).read()) == {'key': 'value'}
示例#5
0
def test_is_yaml_file(valid_yaml_file):
    assert File()._is_yaml_file(valid_yaml_file) == True
    assert File()._is_yaml_file("") == False
示例#6
0
def test_read_file_content(valid_yaml_file):
    assert File()._read_file_content(valid_yaml_file) == "key: value"
示例#7
0
def test_is_file(valid_yaml_file):
    assert File().is_file(valid_yaml_file) == True
示例#8
0
def test_is_directory(tmpdir):
    temp_dir = tmpdir.mkdir("test_dir")
    assert File().is_directory(temp_dir) == True