Ejemplo n.º 1
0
def test_report(config: CloneConfig, resource: TextIO,
                capsys: _pytest.capture.CaptureFixture) -> None:
    stage = Clone(config)
    data = json.load(resource)
    results: ResultMap[GitRepoPath] = ResultMap.structure(
        data, ResultMap[GitRepoPath])

    stage.report_results(results)

    captured = capsys.readouterr()
    assert 'Cloned 100 ' in captured.out
    assert str(config.output_directory) in captured.out
Ejemplo n.º 2
0
def test_stage_run(config: CloneConfig, progress: bool, resource: TextIO,
                   mock_clone: None) -> None:
    config.progress = progress
    stage = Clone(config)
    data = json.load(resource)
    prev: ResultMap[GalaxyRole] = ResultMap.structure(data,
                                                      ResultMap[GalaxyRole])

    paths = stage.run(prev)

    assert len(paths) == 2
    for id_, path in paths.items():
        assert not path.path.is_absolute()
        assert (config.output_directory / path.path).exists()
        assert path.owner == path.path.parent.name == prev[id_].github_user
        assert path.name == path.path.name == prev[id_].github_repo
        assert path.id == id_
Ejemplo n.º 3
0
def test_structure() -> None:
    d = {'test': {'id': 'test', 'val': 1}, 'tset': {'id': 'tset', 'val': -1}}

    rm: ResultMap[Data] = ResultMap.structure(d, ResultMap[Data])

    assert rm == ResultMap(DATA)