예제 #1
0
    def test_given_both_tests_pass_then_shutil_rmtree_called_on_given_file_path(self):

        self.mock_is_local_repo_root.return_value = True

        st.delete_temp_repo("/tmp/git_root_dir")

        self.mock_rmtree.assert_called_once_with("/tmp/git_root_dir")
예제 #2
0
    def test_given_both_tests_pass_then_shutil_rmtree_called_on_given_file_path(self):

        self.mock_is_local_repo_root.return_value = True

        st.delete_temp_repo("/tmp/git_root_dir")

        self.mock_rmtree.assert_called_once_with("/tmp/git_root_dir")
예제 #3
0
    def test_given_repo_not_in_temp_dir_then_exception_raised_with_correct_message(self):

        comp_message = "/usr/bin/not_in_tempdir is not a temporary folder, cannot delete."

        with self.assertRaises(st.SystemTestingError) as e:
            st.delete_temp_repo("/usr/bin/not_in_tempdir")

        self.assertEqual(str(e.exception), comp_message)
예제 #4
0
    def test_given_repo_not_in_temp_dir_then_exception_raised_with_correct_message(self):

        comp_message = "/usr/bin/not_in_tempdir is not a temporary folder, cannot delete."

        with self.assertRaises(st.SystemTestingError) as e:
            st.delete_temp_repo("/usr/bin/not_in_tempdir")

        self.assertEqual(str(e.exception), comp_message)
예제 #5
0
    def test_given_repo_not_git_root_dir_then_exception_raised_with_correct_message(self):

        self.mock_is_local_repo_root.return_value = False

        comp_message = "/tmp/not_git_root_dir is not a git root directory, cannot delete."

        with self.assertRaises(st.SystemTestingError) as e:
            st.delete_temp_repo("/tmp/not_git_root_dir")

        self.assertEqual(str(e.exception), comp_message)
예제 #6
0
    def test_given_repo_not_git_root_dir_then_exception_raised_with_correct_message(self):

        self.mock_is_local_repo_root.return_value = False

        comp_message = "/tmp/not_git_root_dir is not a git root directory, cannot delete."

        with self.assertRaises(st.SystemTestingError) as e:
            st.delete_temp_repo("/tmp/not_git_root_dir")

        self.assertEqual(str(e.exception), comp_message)