Best Python code snippet using Kiwi_python
types.py
Source:types.py
...70 "description": issue.fields.description,71 }72 except jira.exceptions.JIRAError:73 return super().details(url)74 def get_issue_type_from_jira(self):75 """76 Returns the issue type from the actual Jira instance.77 Will try to return ``settings.JIRA_ISSUE_TYPE`` if it exists, otherwise will78 return the first found!79 You may override this method if you want more control and customization,80 see https://kiwitcms.org/blog/tags/customization/81 .. versionadded:: 11.482 """83 try:84 return self.rpc.issue_type_by_name(settings.JIRA_ISSUE_TYPE)85 except KeyError:86 return self.rpc.issue_types()[0]87 def get_project_from_jira(self, execution):88 """89 Returns the project from the actual Jira instance.90 Will try to match execution.run.plan.product.name, otherwise will91 return the first found!92 You may override this method if you want more control and customization,93 see https://kiwitcms.org/blog/tags/customization/94 .. versionadded:: 11.495 """96 try:97 return self.rpc.project(execution.run.plan.product.name)98 except jira.exceptions.JIRAError:99 return self.rpc.projects()[0]100 def _report_issue(self, execution, user):101 """102 JIRA Project == Kiwi TCMS Product, otherwise defaults to the first found103 Issue Type == Bug or the first one found104 If 1-click bug report doesn't work then fall back to manual105 reporting!106 For the HTML API description see:107 https://confluence.atlassian.com/display/JIRA050/Creating+Issues+via+direct+HTML+links108 """109 project = self.get_project_from_jira(execution)110 issue_type = self.get_issue_type_from_jira()111 try:112 new_issue = self.rpc.create_issue(113 project=project.id,114 issuetype={"name": issue_type.name},115 summary=f"Failed test: {execution.case.summary}",116 description=self._report_comment(execution, user),117 )118 new_url = self.bug_system.base_url + "/browse/" + new_issue.key119 # add a link reference that will be shown in the UI120 LinkReference.objects.get_or_create(121 execution=execution,122 url=new_url,123 is_defect=True,124 )...
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!!