Exemplo n.º 1
0
    def test_checking_if_directory_modules_contain_module_name(
        self,
        test_config_directory,
    ):
        enabling_statement = {'name': 'south_america::brazil'}
        directory_module = DirectoryModuleSource(
            enabling_statement=enabling_statement,
            modules_directory=test_config_directory / 'freezed_modules',
        )
        directory_module.config({})

        assert 'south_america::brazil' in directory_module

        assert 'south_america::argentina' not in directory_module
        assert 'brazil' not in directory_module
        assert 'argentina' not in directory_module
Exemplo n.º 2
0
 def test_error_on_enabling_non_existent_module(
     self,
     test_config_directory,
 ):
     enabling_statement = {'name': 'north_america::colombia'}
     with pytest.raises(NonExistentEnabledModule):
         directory_module = DirectoryModuleSource(
             enabling_statement=enabling_statement,
             modules_directory=test_config_directory / 'freezed_modules',
         )
         config = directory_module.config({})
Exemplo n.º 3
0
def test_retrieval_of_external_module_config(test_config_directory):
    external_module_source_config = {'name': 'burma::*'}
    external_module_source = DirectoryModuleSource(
        enabling_statement=external_module_source_config,
        modules_directory=test_config_directory / 'test_modules',
    )

    assert external_module_source.config({}) == {
        f'module/burma::burma': {
            'enabled': True,
            'safe': False,
        },
    }
Exemplo n.º 4
0
 def test_recursive_module_directory(
     self,
     test_config_directory,
 ):
     enabling_statement = {'name': 'recursive/directory::bulgaria'}
     directory_module = DirectoryModuleSource(
         enabling_statement=enabling_statement,
         modules_directory=test_config_directory / 'test_modules',
     )
     assert directory_module.config({}) == {
         'module/recursive/directory::bulgaria': {
             'on_startup': {
                 'run': "echo 'Greetings from Bulgaria!'",
             },
         },
     }
Exemplo n.º 5
0
 def test_getting_config_dict_from_directory_module(
     self,
     test_config_directory,
 ):
     enabling_statement = {'name': 'north_america::USA'}
     directory_module = DirectoryModuleSource(
         enabling_statement=enabling_statement,
         modules_directory=test_config_directory / 'freezed_modules',
     )
     assert directory_module.config({}) == {
         'module/north_america::USA': {
             'on_startup': {
                 'run': 'echo Greetings from the USA!',
             },
         },
         'context/geography': {
             'USA': {
                 'capitol': 'Washington D.C.',
             },
         },
     }
Exemplo n.º 6
0
 def test_enabling_just_one_module_in_diretory(
     self,
     test_config_directory,
 ):
     enabling_statement = {'name': 'south_america::brazil'}
     directory_module = DirectoryModuleSource(
         enabling_statement=enabling_statement,
         modules_directory=test_config_directory / 'freezed_modules',
     )
     assert directory_module.config({}) == {
         'module/south_america::brazil': {
             'on_startup': {
                 'run': 'echo Greetings from Brazil!',
             },
         },
         'context/geography': {
             'brazil': {
                 'capitol': 'Brasilia',
             },
             'argentina': {
                 'capitol': 'Buenos Aires',
             },
         },
     }