def test_load_with_partial_values(): demo_configuration = { 'allowedLicenses': ['MIT', 'GPL'], } with TemporaryDirectory() as directory: with open(Configuration.get_config_file_path(directory), 'w') as config_file: dump(demo_configuration, config_file) configuration = Configuration.load_from_directory(directory) assert configuration == Configuration(['MIT', 'GPL'])
def test_load_with_file(): demo_configuration = { 'allowedLicenses': ['MIT', 'GPL'], 'excludedPackages': ['demo1234'], 'include': [{ 'url': 'http://localhost:8000/license-check-node.yaml' }] } with TemporaryDirectory() as directory: with open(Configuration.get_config_file_path(directory), 'w') as config_file: dump(demo_configuration, config_file) configuration = Configuration.load_from_directory(directory) assert configuration == Configuration(['MIT', 'GPL'], ['demo1234'], [ ConfigurationInclude( 'http://localhost:8000/license-check-node.yaml') ])