Exemple #1
0
def test_invalidate_cache():
    with NamedTemporaryFile() as cache_file:
        with Server(ConfigurationTestServer) as ts:
            base_configuration = Configuration(
                allowed_licenses=['Apache 2.0'],
                includes=[ConfigurationInclude(url=ts.url())],
                cache_name=cache_file.name)
            merged_configuration = base_configuration.merge_includes()

            assert merged_configuration.session.cache.urls == [ts.url()]

            merged_configuration.invalidate_cache()

            assert merged_configuration.session.cache.urls == []
Exemple #2
0
def test_merge_includes():
    with NamedTemporaryFile() as cache_file:
        with Server(ConfigurationTestServer) as ts:
            base_configuration = Configuration(
                allowed_licenses=['Apache 2.0'],
                includes=[
                    ConfigurationInclude(url=ts.url()),
                ],
                cache_name=cache_file.name)
            merged_configuration = base_configuration.merge_includes()

            assert merged_configuration == Configuration(
                allowed_licenses=['Apache 2.0', 'MIT', 'GPL'],
                excluded_packages=['demo1234'],
                includes=[ConfigurationInclude(url=ts.url())])