示例#1
0
 def test_run_raises_runtimeerror_on_file_not_found(self, log_mock, *args):
     handle = log_mock()
     handle.clone_to_a_backup.side_effect = FileNotFoundError(
         TEST_ERROR_RETURN)
     handle.get_file_size_in_megabytes.return_value = TEST_LIMIT_GREATER
     app = _Application()
     with self.assertRaises(RuntimeError) as e:
         app.run()
示例#2
0
    def test_clones_log_on_size_threshold(self, log_mock):
        handle = log_mock()
        handle.get_file_size_in_megabytes.return_value = TEST_LIMIT_GREATER

        app = _Application()
        app.run()

        handle.clone_to_a_backup.assert_called_with()
示例#3
0
    def test_clones_log_on_line_count_threshold(self, log_mock):
        handle = log_mock()
        handle.get_line_count.return_value = TEST_LIMIT_GREATER

        app = _Application()
        app.run()

        handle.clone_to_a_backup.assert_called_with()
示例#4
0
    def test_does_not_clone_log_on_no_thresholds(self, log_mock):
        app = _Application()
        app.run()

        log_mock.clone_to_a_backup.assert_not_called()
示例#5
0
 def test_work_log_storage(self, log_mock):
     app = _Application()
     handle = log_mock()
     self.assertEqual(app._work_log, handle)
示例#6
0
 def test_work_log_creation(self, log_mock):
     app = _Application()
     log_mock.assert_called_with(TEST_LOG_PATH)
示例#7
0
 def test_no_threshold_storage(self, *stubs):
     app = _Application()
     self.assertEqual(app._size_limit_mb, None)
     self.assertEqual(app._line_limit, None)
示例#8
0
 def test_size_and_line_threshold_storage(self, *stubs):
     app = _Application()
     self.assertEqual(app._size_limit_mb, TEST_LIMIT_VALUE_A)
     self.assertEqual(app._line_limit, TEST_LIMIT_VALUE_B)
示例#9
0
 def test_size_threshold_storage_with_float(self, *stubs):
     app = _Application()
     self.assertEqual(app._size_limit_mb, TEST_LIMIT_VALUE_C)
     self.assertEqual(app._line_limit, None)
示例#10
0
 def test_constructor_raises_runtimeerror_on_file_not_found(self, *args):
     with self.assertRaises(RuntimeError) as e:
         _Application()
示例#11
0
 def test_constructor_raises_runtimeerror_on_bad_permissions(self, *args):
     with self.assertRaises(RuntimeError) as e:
         _Application()