##// END OF EJS Templates
tests: fixed tests for new source ref checking.
marcink -
r2473:32635607 default
parent child Browse files
Show More
@@ -566,7 +566,8 b' TODO: To be written...'
566
566
567 def test_maybe_prepare_merge_workspace(self):
567 def test_maybe_prepare_merge_workspace(self):
568 workspace = self.repo._maybe_prepare_merge_workspace(
568 workspace = self.repo._maybe_prepare_merge_workspace(
569 'pr2', Reference('branch', 'master', 'unused'))
569 'pr2', Reference('branch', 'master', 'unused'),
570 Reference('branch', 'master', 'unused'))
570
571
571 assert os.path.isdir(workspace)
572 assert os.path.isdir(workspace)
572 workspace_repo = GitRepository(workspace)
573 workspace_repo = GitRepository(workspace)
@@ -574,12 +575,29 b' TODO: To be written...'
574
575
575 # Calling it a second time should also succeed
576 # Calling it a second time should also succeed
576 workspace = self.repo._maybe_prepare_merge_workspace(
577 workspace = self.repo._maybe_prepare_merge_workspace(
577 'pr2', Reference('branch', 'master', 'unused'))
578 'pr2', Reference('branch', 'master', 'unused'),
579 Reference('branch', 'master', 'unused'))
580 assert os.path.isdir(workspace)
581
582 def test_maybe_prepare_merge_workspace_different_refs(self):
583 workspace = self.repo._maybe_prepare_merge_workspace(
584 'pr2', Reference('branch', 'master', 'unused'),
585 Reference('branch', 'develop', 'unused'))
586
587 assert os.path.isdir(workspace)
588 workspace_repo = GitRepository(workspace)
589 assert workspace_repo.branches == self.repo.branches
590
591 # Calling it a second time should also succeed
592 workspace = self.repo._maybe_prepare_merge_workspace(
593 'pr2', Reference('branch', 'master', 'unused'),
594 Reference('branch', 'develop', 'unused'))
578 assert os.path.isdir(workspace)
595 assert os.path.isdir(workspace)
579
596
580 def test_cleanup_merge_workspace(self):
597 def test_cleanup_merge_workspace(self):
581 workspace = self.repo._maybe_prepare_merge_workspace(
598 workspace = self.repo._maybe_prepare_merge_workspace(
582 'pr3', Reference('branch', 'master', 'unused'))
599 'pr3', Reference('branch', 'master', 'unused'),
600 Reference('branch', 'master', 'unused'))
583 self.repo.cleanup_merge_workspace('pr3')
601 self.repo.cleanup_merge_workspace('pr3')
584
602
585 assert not os.path.exists(workspace)
603 assert not os.path.exists(workspace)
@@ -552,18 +552,21 b' TODO: To be written...'
552 assert commit.message == merge_message
552 assert commit.message == merge_message
553
553
554 def test_maybe_prepare_merge_workspace(self):
554 def test_maybe_prepare_merge_workspace(self):
555 workspace = self.repo._maybe_prepare_merge_workspace('pr2', 'unused')
555 workspace = self.repo._maybe_prepare_merge_workspace(
556 'pr2', 'unused', 'unused2')
556
557
557 assert os.path.isdir(workspace)
558 assert os.path.isdir(workspace)
558 workspace_repo = MercurialRepository(workspace)
559 workspace_repo = MercurialRepository(workspace)
559 assert workspace_repo.branches == self.repo.branches
560 assert workspace_repo.branches == self.repo.branches
560
561
561 # Calling it a second time should also succeed
562 # Calling it a second time should also succeed
562 workspace = self.repo._maybe_prepare_merge_workspace('pr2', 'unused')
563 workspace = self.repo._maybe_prepare_merge_workspace(
564 'pr2', 'unused', 'unused2')
563 assert os.path.isdir(workspace)
565 assert os.path.isdir(workspace)
564
566
565 def test_cleanup_merge_workspace(self):
567 def test_cleanup_merge_workspace(self):
566 workspace = self.repo._maybe_prepare_merge_workspace('pr3', 'unused')
568 workspace = self.repo._maybe_prepare_merge_workspace(
569 'pr3', 'unused', 'unused2')
567 self.repo.cleanup_merge_workspace('pr3')
570 self.repo.cleanup_merge_workspace('pr3')
568
571
569 assert not os.path.exists(workspace)
572 assert not os.path.exists(workspace)
@@ -104,7 +104,7 b' class TestMercurialRemoteRepoInvalidatio'
104 pr = PullRequestModel()
104 pr = PullRequestModel()
105 workspace_id = pr._workspace_id(pull_request)
105 workspace_id = pr._workspace_id(pull_request)
106 shadow_repository_path = target_vcs._maybe_prepare_merge_workspace(
106 shadow_repository_path = target_vcs._maybe_prepare_merge_workspace(
107 workspace_id, target_ref)
107 workspace_id, target_ref, source_ref)
108 shadow_repo = target_vcs._get_shadow_instance(shadow_repository_path)
108 shadow_repo = target_vcs._get_shadow_instance(shadow_repository_path)
109
109
110 # This will populate the cache of the mercurial repository object
110 # This will populate the cache of the mercurial repository object
General Comments 0
You need to be logged in to leave comments. Login now