Example #1
0
    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")
Example #2
0
    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"
                            })
Example #3
0
    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")
Example #4
0
    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})