diff options
Diffstat (limited to 'tests/test_subcmds_sync.py')
-rw-r--r-- | tests/test_subcmds_sync.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py index 9cd19f10..5955e404 100644 --- a/tests/test_subcmds_sync.py +++ b/tests/test_subcmds_sync.py | |||
@@ -309,6 +309,7 @@ class FakeProject: | |||
309 | self.relpath = relpath | 309 | self.relpath = relpath |
310 | self.name = name or relpath | 310 | self.name = name or relpath |
311 | self.objdir = objdir or relpath | 311 | self.objdir = objdir or relpath |
312 | self.worktree = relpath | ||
312 | 313 | ||
313 | self.use_git_worktrees = False | 314 | self.use_git_worktrees = False |
314 | self.UseAlternates = False | 315 | self.UseAlternates = False |
@@ -836,6 +837,25 @@ class InterleavedSyncTest(unittest.TestCase): | |||
836 | project.Sync_NetworkHalf.assert_called_once() | 837 | project.Sync_NetworkHalf.assert_called_once() |
837 | project.Sync_LocalHalf.assert_not_called() | 838 | project.Sync_LocalHalf.assert_not_called() |
838 | 839 | ||
840 | def test_worker_no_worktree(self): | ||
841 | """Test interleaved sync does not checkout with no worktree.""" | ||
842 | opt = self._get_opts() | ||
843 | project = self.projA | ||
844 | project.worktree = None | ||
845 | project.Sync_NetworkHalf = mock.Mock( | ||
846 | return_value=SyncNetworkHalfResult(error=None, remote_fetched=True) | ||
847 | ) | ||
848 | project.Sync_LocalHalf = mock.Mock() | ||
849 | self.mock_context["projects"] = [project] | ||
850 | |||
851 | result_obj = self.cmd._SyncProjectList(opt, [0]) | ||
852 | result = result_obj.results[0] | ||
853 | |||
854 | self.assertTrue(result.fetch_success) | ||
855 | self.assertTrue(result.checkout_success) | ||
856 | project.Sync_NetworkHalf.assert_called_once() | ||
857 | project.Sync_LocalHalf.assert_not_called() | ||
858 | |||
839 | def test_worker_fetch_fails_exception(self): | 859 | def test_worker_fetch_fails_exception(self): |
840 | """Test _SyncProjectList with an exception during fetch.""" | 860 | """Test _SyncProjectList with an exception during fetch.""" |
841 | opt = self._get_opts() | 861 | opt = self._get_opts() |