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()
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()
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()
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()
def test_work_log_storage(self, log_mock): app = _Application() handle = log_mock() self.assertEqual(app._work_log, handle)
def test_work_log_creation(self, log_mock): app = _Application() log_mock.assert_called_with(TEST_LOG_PATH)
def test_no_threshold_storage(self, *stubs): app = _Application() self.assertEqual(app._size_limit_mb, None) self.assertEqual(app._line_limit, None)
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)
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)
def test_constructor_raises_runtimeerror_on_file_not_found(self, *args): with self.assertRaises(RuntimeError) as e: _Application()
def test_constructor_raises_runtimeerror_on_bad_permissions(self, *args): with self.assertRaises(RuntimeError) as e: _Application()