Best Python code snippet using Kiwi_python
types.py
Source:types.py
...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,...
jira_plugin.py
Source:jira_plugin.py
...74 difference_current_today = (current_date - end_date).days75 delayed_percentage = int((difference_current_today/difference_start_end)*100)76 status_string += 'Delayed by {}%'.format(delayed_percentage)77 return status_string78def get_project_from_jira(key) -> Dict:79 """80 get_project_from_jira method takes key as argument and retrives81 corrosponding project detail from JIRA api.82 :param key: Unique key for JIRA project.83 :type key: str84 :return: Return a Dict object having fields projec_id,85 project_name, assigned_pm and status.86 :rtype: Dict87 """88 try:89 new_response = requests.get(90 JIRA_EPIC+'/'+key, auth=(JIRA_USER, JIRA_PASSWORD))91 if new_response.status_code == 500:92 logger.error("Invalid Credentials ! Couldn't connect to JIRA.")...
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!!