Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomáš Daniel committed Nov 13, 2023
1 parent 3de36fb commit 07cab44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions example/apps/test_security/tests/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,10 @@ def test_elasticsearch_purge_logs_should_remove_logged_data(self):
).count(), 0)
assert_equal(len(os.listdir(log_directory)), 1)
shutil.rmtree(settings.BACKUP_STORAGE_PATH)

@override_settings(
SECURITY_COMMAND_LOG_EXCLUDED_COMMANDS={'init_elasticsearch_log'},
SECURITY_BACKUP_STORAGE_PATH=os.path.join(django_settings.PROJECT_DIR, 'var', 'backup_elastic')
)
def test_sql_purge_logs_should_remove_logged_data(self):
test_call_command('init_elasticsearch_log', interactive=False)
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ def handle(self, **options):
self.stdout.write('Init elasticsearch logs')
set_connection(init_documents=False)
for document in InputRequestLog, OutputRequestLog, CommandLog, CeleryTaskRunLog, CeleryTaskInvocationLog:
document._index.delete(ignore=404)
document.init()
if issubclass(document, PartitionedLog):
template = document.get_template()
template.save()
else:
document._index.delete(ignore=404)
document.init()

0 comments on commit 07cab44

Please sign in to comment.