def test_one_unmerged_branch_that_is_included(self):
     """ Test that the unmerged branch is returned when it is explicitly included. """
     self.__svn.mergeinfo = 'rev1\nrev2\nrev3\nrev4\nrev5'
     self.assertEqual(
         [Branch("folder", 5, datetime.datetime(2018, 7, 24, 7, 46, 27))],
         self.__svn.unmerged_branches(
             'http://svn/', list_of_branches_to_include=['folder']))
Пример #2
0
 def test_unmerged_branches_invalid_date(self, mock_chdir, mock_exists):
     """ Test that the last change date of a branch is the minimum date if parsing fails. """
     mock_exists.return_value = True
     with patch.object(subprocess, "check_output",
                       side_effect=["pull output", "branch\n", "commit_id\n", "invalid_date\n"]):
         self.assertEqual([Branch("branch", 1, datetime.datetime.min)], self.__git.unmerged_branches('path'))
     mock_chdir.assert_called()
Пример #3
0
 def test_unmerged_branches_with_repo(self, mock_chdir, mock_exists):
     """ Test the unmerged branches with a (faked) repo. """
     mock_exists.return_value = True
     expected_datetime = datetime.datetime.fromtimestamp(1490445344.0)
     with patch.object(subprocess, "check_output",
                       side_effect=["pull output", "branch\n", "commit_id\n", "1490445344.0\n"]):
         branches = self.__git.unmerged_branches('path')
     self.assertEqual([Branch("branch", 1, expected_datetime)], branches)
     mock_chdir.assert_called()
Пример #4
0
 def test_unmerged_branches_invalid_date(self):
     """ Test that the last change date of a branch is the minimum date if parsing fails. """
     VersionControlSystem._run_shell_command.cache_clear()
     Git._run_shell_command.cache_clear()
     git = Git(url=self.__git.url(),
               username='******',
               password='******',
               run_shell_command=lambda *args, **kwargs: "invalid date\n"
               if "show" in args[0] else "branch\n")
     self.assertEqual([Branch("branch", 1, datetime.datetime.min)],
                      git.unmerged_branches('path'))
Пример #5
0
 def test_unmerged_branches_with_repo(self):
     """ Test the unmerged branches with a (faked) repo. """
     VersionControlSystem._run_shell_command.cache_clear()
     Git._run_shell_command.cache_clear()
     git = Git(url=self.__git.url(),
               username='******',
               password='******',
               run_shell_command=lambda *args, **kwargs: "1490445344.0\n"
               if "log" in args[0] else "branch\n")
     expected_datetime = datetime.datetime.fromtimestamp(1490445344.0)
     self.assertEqual([Branch("branch", 1, expected_datetime)],
                      git.unmerged_branches('path'))
 def test_one_unmerged_branch(self):
     """ Test one unmerged branch. """
     self.__svn.mergeinfo = 'rev1\nrev2\nrev3\nrev4\nrev5'
     self.assertEqual(
         [Branch("folder", 5, datetime.datetime(2018, 7, 24, 7, 46, 27))],
         self.__svn.unmerged_branches('http://svn/'))
Пример #7
0
 def test_equality(self):
     """ Test the equality function. """
     now = datetime.datetime.now()
     self.assertEqual(Branch("branch"), Branch("branch"))
     self.assertNotEqual(Branch("branch"), Branch("other branch"))
     self.assertEqual(Branch("branch", 2), Branch("branch", 2))
     self.assertNotEqual(Branch("branch", 2), Branch("branch", 3))
     self.assertEqual(Branch("branch", 2, now), Branch("branch", 2, now))
     self.assertNotEqual(Branch("branch", 2, now), Branch("branch", 2))
Пример #8
0
 def test_repr(self):
     """ Test the repr function. """
     self.assertEqual("Branch(branch, None, 0001-01-01 00:00:00)", repr(Branch("branch")))