Best Python code snippet using Kiwi_python
kiwitcms.py
Source:kiwitcms.py
...21 def details(self, url):22 """23 Provide more details from our own bug tracker!24 """25 bug_id = self.bug_id_from_url(url)26 bug = Bug.objects.filter(pk=bug_id).first()27 if not bug:28 return {}29 result = {30 'title': bug.summary,31 'description': render_to_string('include/bug_details.html',32 {'object': bug})33 }34 return result35 def add_testexecution_to_issue(self, executions, issue_url):36 """37 Directly 'link' BUG and TE objects via their m2m38 relationship.39 .. note::40 This method takes extra steps to safeguard from41 bogus input b/c it is called unconditionally from42 API method ``TestCase.add_link()``!43 """44 try:45 bug_id = self.bug_id_from_url(issue_url)46 except AttributeError:47 return48 try:49 bug = Bug.objects.get(pk=bug_id)50 except Bug.DoesNotExist:51 return52 for execution in executions:53 bug.executions.add(execution)54 def report_issue_from_testexecution(self, execution, user):55 """56 Create the new bug using internal API instead of57 going through the RPC layer and return its URL58 """59 data = {60 'reporter': user,61 'summary': 'Failed test: %s' % execution.case.summary,62 'product': execution.run.plan.product,63 'version': execution.run.product_version,64 'build': execution.build,65 'text': self._report_comment(execution),66 '_execution': execution,67 }68 bug = New.create_bug(data)69 # link Bug to TE via m2m70 bug.executions.add(execution)71 # and also add a link reference that will be shown in the UI72 LinkReference.objects.get_or_create(73 execution=execution,74 url=bug.get_full_url(),75 is_defect=True,76 )77 return bug.get_full_url()78 @classmethod79 def bug_id_from_url(cls, url):80 """81 Strips the last '/' and returns the PK82 """...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!