How to use delete_log method in tempest

Best Python code snippet using tempest_python

audit.py

Source:audit.py Github

copy

Full Screen

...13 # otherwise, we want to still log to our actual logging14 if entry.event is not None:15 entry.save()16 if entry.event == AuditLogEntryEvent.ORG_REMOVE:17 create_org_delete_log(entry)18 elif entry.event == AuditLogEntryEvent.PROJECT_REMOVE:19 create_project_delete_log(entry)20 elif entry.event == AuditLogEntryEvent.TEAM_REMOVE:21 create_team_delete_log(entry)22 extra = {23 'ip_address': entry.ip_address,24 'organization_id': entry.organization_id,25 'object_id': entry.target_object,26 'entry_id': entry.id,27 'actor_label': entry.actor_label28 }29 if entry.actor_id:30 extra['actor_id'] = entry.actor_id31 if entry.actor_key_id:32 extra['actor_key_id'] = entry.actor_key_id33 if transaction_id is not None:34 extra['transaction_id'] = transaction_id35 if logger:36 logger.info(entry.get_event_display(), extra=extra)37 return entry38def create_org_delete_log(entry):39 delete_log = DeletedOrganization()40 organization = Organization.objects.get(id=entry.target_object)41 delete_log.name = organization.name42 delete_log.slug = organization.slug43 delete_log.date_created = organization.date_added44 complete_delete_log(delete_log, entry)45def create_project_delete_log(entry):46 delete_log = DeletedProject()47 project = Project.objects.get(id=entry.target_object)48 delete_log.name = project.name49 delete_log.slug = project.slug50 delete_log.date_created = project.date_added51 delete_log.platform = project.platform52 delete_log.organization_id = entry.organization.id53 delete_log.organization_name = entry.organization.name54 delete_log.organization_slug = entry.organization.slug55 complete_delete_log(delete_log, entry)56def create_team_delete_log(entry):57 delete_log = DeletedTeam()58 team = Team.objects.get(id=entry.target_object)59 delete_log.name = team.name60 delete_log.slug = team.slug61 delete_log.date_created = team.date_added62 delete_log.organization_id = entry.organization.id63 delete_log.organization_name = entry.organization.name64 delete_log.organization_slug = entry.organization.slug65 complete_delete_log(delete_log, entry)66def complete_delete_log(delete_log, entry):67 """68 Adds common information on a delete log from an audit entry and69 saves that delete log.70 """71 delete_log.actor_label = entry.actor_label72 delete_log.actor_id = entry.actor_id73 delete_log.actor_key = entry.actor_key74 delete_log.ip_address = entry.ip_address...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful