def test_repo_init_spec_no_alias(self, mock_run): mock_run.return_value = subprocess.CompletedProcess( None, 0, _FAKE_REPO_INFO) repo = cipd_utils.Repo("/repo/root", spec={"foo": None}) self.assertEqual(len(repo.git_repos), 1) self.assertEqual(repo.git_repos["foo"].repo_path, "/repo/root/foo")
def test_repo_init_spec_name_collision(self, mock_run): mock_run.return_value = subprocess.CompletedProcess( None, 0, _FAKE_REPO_INFO) with self.assertRaises(ValueError): cipd_utils.Repo("/repo/root", spec={ "foo": "same_alias", "baz": "same_alias" })
def test_repo_init(self, mock_run): mock_run.return_value = subprocess.CompletedProcess( None, 0, _FAKE_REPO_INFO) repo = cipd_utils.Repo("/repo/root") self.assertEqual(get_run_commands(mock_run), [["repo", "info", "--local-only"]]) self.assertEqual(len(repo.git_repos), 2) self.assertEqual(repo.git_repos["foo"].repo_path, "/repo/root/foo") self.assertEqual(repo.git_repos["bar/baz"].repo_path, "/repo/root/baz")
def test_repo_init_spec_unused(self, mock_run): mock_run.return_value = subprocess.CompletedProcess( None, 0, _FAKE_REPO_INFO) with self.assertRaises(ValueError): cipd_utils.Repo("/repo/root", spec={"foo": None, "unknown": None})