Example #1
0
 def test_repo_alternates_objects_shared(self):
     """Ensure objects are shared from alternate repo."""
     factory = RepoFactory(self.repo_path)
     commit_oid = factory.add_commit("foo", "foobar.txt")
     new_repo_path = os.path.join(self.repo_store, uuid.uuid4().hex)
     repo_path_with_alt = store.init_repo(new_repo_path, alternate_repo_paths=[factory.repo.path])
     repo_with_alt = open_repo(repo_path_with_alt)
     self.assertEqual(commit_oid.hex, repo_with_alt.get(commit_oid).hex)
Example #2
0
    def test_repo_init_with_clone(self):
        """Repo can be initialised with optional clone."""
        factory = RepoFactory(self.repo_store, num_commits=2)
        factory.build()
        new_repo_path = uuid.uuid1().hex
        resp = self.app.post_json('/repo', {'repo_path': new_repo_path,
                                            'clone_from': self.repo_path,
                                            'clone_refs': True})
        repo1_revlist = get_revlist(factory.repo)
        clone_from = resp.json['repo_url'].split('/')[-1]
        repo2 = open_repo(os.path.join(self.repo_root, clone_from))
        repo2_revlist = get_revlist(repo2)

        self.assertEqual(repo1_revlist, repo2_revlist)
        self.assertEqual(200, resp.status_code)
        self.assertIn(new_repo_path, resp.json['repo_url'])