summaryrefslogtreecommitdiffstats
path: root/tests/test_config_loader.py
blob: c10e3296cd114ca0cbbc2c4dde985872ac5fc29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from pathlib import Path

from onap_data_provider.config_loader import ConfigLoader


def test_config_loader_no_dirs():
    config_loader = ConfigLoader([Path(Path(__file__).parent, "test-data.yml")])
    configs = list(config_loader.load())
    assert len(configs) == 1

    config_loader = ConfigLoader([Path(Path(__file__).parent, "test-data.yml"),
                                  Path(Path(__file__).parent, "test-data-version.yml")])
    configs = list(config_loader.load())
    assert len(configs) == 2

def test_config_loader_dir():
    config_loader = ConfigLoader([Path(Path(__file__).parent, "config_dirs")])
    configs = list(config_loader.load())
    assert len(configs) == 2

def test_config_loader_both_dirs_and_files():
    config_loader = ConfigLoader([Path(Path(__file__).parent, "test-data.yml"),
                                  Path(Path(__file__).parent, "test-data-version.yml"),
                                  Path(Path(__file__).parent, "config_dirs")])
    configs = list(config_loader.load())
    assert len(configs) == 4