Exemple #1
0
 def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
         configuration: Configuration) -> None:
     """
     callback for command line
     :param args: command line args
     :param architecture: repository architecture
     :param configuration: configuration instance
     """
     dump = configuration.dump()
     for section, values in sorted(dump.items()):
         Dump._print(f"[{section}]")
         for key, value in sorted(values.items()):
             Dump._print(f"{key} = {value}")
         Dump._print()
Exemple #2
0
def test_dump_architecture_specific(configuration: Configuration) -> None:
    """
    dump must contain architecture specific settings
    """
    section = configuration.section_name("build", "x86_64")
    configuration.add_section(section)
    configuration.set(section, "archbuild_flags", "hello flag")
    configuration.merge_sections("x86_64")

    dump = configuration.dump()
    assert dump
    assert "build" in dump
    assert section not in dump
    assert dump["build"]["archbuild_flags"] == "hello flag"
Exemple #3
0
def test_run(args: argparse.Namespace, configuration: Configuration,
             mocker: MockerFixture) -> None:
    """
    must run command
    """
    mocker.patch("pathlib.Path.mkdir")
    print_mock = mocker.patch("ahriman.application.handlers.dump.Dump._print")
    application_mock = mocker.patch(
        "ahriman.core.configuration.Configuration.dump",
        return_value=configuration.dump())

    Dump.run(args, "x86_64", configuration)
    application_mock.assert_called_once()
    print_mock.assert_called()
Exemple #4
0
def test_dump(configuration: Configuration) -> None:
    """
    dump must not be empty
    """
    assert configuration.dump()