def test_021_add( data_dir: pathlib.Path, root_repo: pygit2.Repository, repo_1_url: str, repo_1_path: pathlib.Path, repo_2_url: str, repo_2_path: pathlib.Path, ) -> None: core.init() core.add(path=repo_1_path, url=repo_1_url) actual_config = config.Config.load(path=pathlib.Path('wok.yml')) expected_config = config.Config.load(path=data_dir / '021_a_wok.yml') expected_config.repos[0].url = str(data_dir / expected_config.repos[0].url) assert actual_config == expected_config repo_1 = pygit2.Repository(str(repo_1_path)) assert repo_1.remotes['origin'].url == repo_1_url core.add(path=repo_2_path, url=repo_2_url) actual_config = config.Config.load(path=pathlib.Path('wok.yml')) expected_config = config.Config.load(path=data_dir / '021_b_wok.yml') expected_config.repos[0].url = str(data_dir / expected_config.repos[0].url) expected_config.repos[1].url = str(data_dir / expected_config.repos[1].url) assert actual_config == expected_config repo_2 = pygit2.Repository(str(repo_2_path)) assert repo_2.remotes['origin'].url == repo_2_url
def test_004_init_with_empty_repo(data_dir: pathlib.Path, empty_repo: pygit2.Repository) -> None: core.init() assert config.Config.load( path=pathlib.Path('wok.yml')) == config.Config.load(path=data_dir / '004_wok.yml')
def test_002_init(data_dir: pathlib.Path, root_repo: pygit2.Repository) -> None: core.init() assert config.Config.load( path=pathlib.Path('wok.yml')) == config.Config.load(path=data_dir / '002_wok.yml')
def test_003_init_in_branch(data_dir: pathlib.Path, root_repo: pygit2.Repository) -> None: dev_branch = root_repo.branches.local.create( name='dev', commit=next(root_repo.walk(root_repo.head.target))) root_repo.checkout(refname=dev_branch, strategy=pygit2.GIT_CHECKOUT_FORCE) core.init() assert config.Config.load( path=pathlib.Path('wok.yml')) == config.Config.load(path=data_dir / '003_wok.yml')
def test_003_init_in_branch( data_dir: pathlib.Path, root_repo: pygit2.Repository ) -> None: dev_branch = root_repo.branches.local.create( name='dev', commit=root_repo.head.peel() ) root_repo.checkout(refname=dev_branch) core.init() assert config.Config.load(path=pathlib.Path('wok.yml')) == config.Config.load( path=data_dir / '003_wok.yml' )
def test_011_commit(root_repo: pygit2.Repository) -> None: core.init() core.commit() assert root_repo.status() == {}