Пример #1
0
    def test_cleanup_without_delete(self, shutil_mock):
        options = MagicMock()
        options.no_delete = True
        with open(os.devnull, 'w') as sys.stderr:
            cleanup(options, "/tmp")

        self.assertEqual(shutil_mock.rmtree.call_args_list, [])
Пример #2
0
    def test_cleanup_without_delete(self, shutil_mock):
        options = MagicMock()
        options.no_delete = True
        with open(os.devnull, 'w') as sys.stderr:
            cleanup(options, "/tmp")

        self.assertEqual(shutil_mock.rmtree.call_args_list, [])
Пример #3
0
 def test_cleanup_delete(self, shutil_mock):
     options = MagicMock()
     options.no_delete = False
     cleanup(options, "/tmp")
     self.assertEqual(
         shutil_mock.rmtree.call_args_list,
         [call('/tmp')]
     )
Пример #4
0
 def test_cleanup_delete(self, shutil_mock):
     options = MagicMock()
     options.no_delete = False
     cleanup(options, "/tmp")
     self.assertEqual(shutil_mock.rmtree.call_args_list, [call('/tmp')])