def test_run_returns_zero_on_valid_configuration(self):
        base_configuration = Configuration(
            allowed_licenses=['MIT', 'Apache 2.0'],
            includes=[
                ConfigurationInclude(url='https://examle.com/test.yaml'),
                ConfigurationInclude(url='https://examle.com/test2.yaml'),
            ],
            cache_name=self.cache_file.name)

        base_configuration.save_to_directory(self.directory.name)

        args = Mock()
        args.filenames = [
            Path(self.directory.name, CONFIG_FILE_NAME).absolute()
        ]

        assert self.checker.run(args) == 0

        assert Configuration.load_from_directory(
            self.directory.name) == Configuration(
                allowed_licenses=['Apache 2.0', 'MIT'],
                includes=[
                    ConfigurationInclude(url='https://examle.com/test.yaml'),
                    ConfigurationInclude(url='https://examle.com/test2.yaml'),
                ],
                cache_name=self.cache_file.name)
Exemple #2
0
    def prepare_test_directory(self):
        base_configuration = Configuration(
            allowed_licenses=['MIT', 'Apache 2.0'], )

        base_configuration.save_to_directory(self.directory.name)