Пример #1
0
 def test_get_file_up_to_date(self, mock_subproc_popen):
     process_mock = mock.Mock()
     attrs = {'communicate.return_value': ('', 'error')}
     process_mock.configure_mock(**attrs)
     mock_subproc_popen.return_value = process_mock
     x = get_git_file_info("C:\Users\Zed\Desktop\cst 236 lab 6\cst236_lab4\projectRequirements.txt")
     self.assertEqual(x, 'projectRequirements.txt is up to date')
     self.assertTrue(mock_subproc_popen.called)
Пример #2
0
 def test_status_of_file(self, mock_subproc_popen):
     process_mock = mock.Mock()
     attrs = {'communicate.return_value': ('output', '')}
     process_mock.configure_mock(**attrs)
     mock_subproc_popen.return_value = process_mock
     x = get_git_file_info("C:\Users\Zed\Desktop\cst 236 lab 6\cst236_lab4\projectRequirements.txt")
     self.assertEquals(x, 'projectRequirements.txt is a dirty repo')
     self.assertTrue(mock_subproc_popen.called)
Пример #3
0
 def test_get_abs_path(self, mock_subproc_popen):
     process_mock = mock.Mock()
     attrs = {'communicate.return_value': (
         "projectRequirements.txt", '')}
     process_mock.configure_mock(**attrs)
     mock_subproc_popen.return_value = process_mock
     x = get_git_file_info("projectRequirements.txt")
     self.assertTrue(x)
     self.assertTrue(mock_subproc_popen.called)
Пример #4
0
 def test_status_of_file_modified(self, mock_subproc_popen):
     process_mock = mock.Mock()
     attrs = {'communicate.return_value': (
         "C:\\Users\Zed\Desktop\cst 236 lab 5\cst236_lab4\projectRequirements.txt", '')}
     process_mock.configure_mock(**attrs)
     mock_subproc_popen.return_value = process_mock
     x = get_git_file_info("C:\Users\Zed\Desktop\cst 236 lab 5\cst236_lab4\projectRequirements.txt")
     self.assertEquals(x, 'projectRequirements.txt has been modified locally')
     self.assertTrue(mock_subproc_popen.called)
Пример #5
0
 def test_get_abs_path(self, mock_subproc_popen):
     """
     test func using mock to test the absolute file path
     :param mock_subproc_popen:
     :return: valid if the path is absolute
     """
     process_mock = mock.Mock()
     attrs = {'communicate.return_value': (
         "projectRequirements.txt", '')}
     process_mock.configure_mock(**attrs)
     mock_subproc_popen.return_value = process_mock
     value = get_git_file_info("projectRequirements.txt")
     self.assertTrue(value)
     self.assertTrue(mock_subproc_popen.called)