How to use jira method in toolium

Best Python code snippet using toolium_python

views.py

Source:views.py Github

copy

Full Screen

...61 finding.notes.add(new_note)62 finding.save()63 return HttpResponse('')64@user_passes_test(lambda u: u.is_staff)65def new_jira(request):66 if request.method == 'POST':67 jform = JIRAForm(request.POST, instance=JIRA_Conf())68 if jform.is_valid():69 try:70 jira_server = jform.cleaned_data.get('url').rstrip('/')71 jira_username = jform.cleaned_data.get('username')72 jira_password = jform.cleaned_data.get('password')73 # Instantiate JIRA instance for validating url, username and password74 JIRA(server=jira_server,75 basic_auth=(jira_username, jira_password))76 new_j = jform.save(commit=False)77 new_j.url = jira_server78 new_j.save()79 messages.add_message(request,80 messages.SUCCESS,81 'JIRA Configuration Successfully Created.',82 extra_tags='alert-success')83 return HttpResponseRedirect(reverse('jira', ))84 except Exception:85 messages.add_message(request,86 messages.ERROR,87 'Unable to authenticate. Please check the URL, username, and password.',88 extra_tags='alert-danger')89 else:90 jform = JIRAForm()91 add_breadcrumb(title="New Jira Configuration", top_level=False, request=request)92 return render(request, 'dojo/new_jira.html',93 {'jform': jform})94@user_passes_test(lambda u: u.is_staff)95def edit_jira(request, jid):96 jira = JIRA_Conf.objects.get(pk=jid)97 if request.method == 'POST':98 jform = JIRAForm(request.POST, instance=jira)99 if jform.is_valid():100 try:101 jira_server = jform.cleaned_data.get('url').rstrip('/')102 jira_username = jform.cleaned_data.get('username')103 jira_password = jform.cleaned_data.get('password')104 # Instantiate JIRA instance for validating url, username and password105 JIRA(server=jira_server,106 basic_auth=(jira_username, jira_password))107 new_j = jform.save(commit=False)108 new_j.url = jira_server109 new_j.save()110 messages.add_message(request,111 messages.SUCCESS,112 'JIRA Configuration Successfully Created.',113 extra_tags='alert-success')114 return HttpResponseRedirect(reverse('jira', ))115 except Exception:116 messages.add_message(request,117 messages.ERROR,118 'Unable to authenticate. Please check the URL, username, and password.',119 extra_tags='alert-danger')120 else:121 jform = JIRAForm(instance=jira)122 add_breadcrumb(title="Edit JIRA Configuration", top_level=False, request=request)123 return render(request,124 'dojo/edit_jira.html',125 {126 'jform': jform,127 })128@user_passes_test(lambda u: u.is_staff)129def delete_issue(request, find):130 j_issue = JIRA_Issue.objects.get(finding=find)131 jira_conf = find.jira_conf()132 jira = JIRA(server=jira_conf.url,133 basic_auth=(jira_conf.username,134 jira_conf.password))135 issue = jira.issue(j_issue.jira_id)136 issue.delete()137@user_passes_test(lambda u: u.is_staff)138def jira(request):139 confs = JIRA_Conf.objects.all()140 add_breadcrumb(title="JIRA List", top_level=not len(request.GET), request=request)141 return render(request,142 'dojo/jira.html',143 {'confs': confs,144 })145@user_passes_test(lambda u: u.is_staff)146def delete_jira(request, tid):147 jira_instance = get_object_or_404(JIRA_Conf, pk=tid)148 # eng = test.engagement149 # TODO Make Form150 form = DeleteJIRAConfForm(instance=jira_instance)151 collector = NestedObjects(using=DEFAULT_DB_ALIAS)152 collector.collect([jira_instance])153 rels = collector.nested()154 if request.method == 'POST':155 if 'id' in request.POST and str(jira_instance.id) == request.POST['id']:156 form = DeleteJIRAConfForm(request.POST, instance=jira_instance)157 if form.is_valid():158 jira_instance.delete()159 messages.add_message(request,160 messages.SUCCESS,...

Full Screen

Full Screen

gobblin-jira-version

Source:gobblin-jira-version Github

copy

Full Screen

1#!/usr/bin/env python2#3# Licensed to the Apache Software Foundation (ASF) under one or more4# contributor license agreements. See the NOTICE file distributed with5# this work for additional information regarding copyright ownership.6# The ASF licenses this file to You under the Apache License, Version 2.07# (the "License"); you may not use this file except in compliance with8# the License. You may obtain a copy of the License at9#10# http://www.apache.org/licenses/LICENSE-2.011#12# Unless required by applicable law or agreed to in writing, software13# distributed under the License is distributed on an "AS IS" BASIS,14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15# See the License for the specific language governing permissions and16# limitations under the License.17#18# Utility for updating fix version for Jiras.19#20# usage: ./gobblin-jira-version (see config env vars below)21#22from __future__ import print_function23import json24import os25import re26import subprocess27import sys28import textwrap29# Python 3 compatibility30try:31 import urllib2 as urllib32except ImportError:33 import urllib.request as urllib34if sys.version_info[0] == 3:35 raw_input = input36try:37 import click38except ImportError:39 print("Could not find the click library. Run 'sudo pip install click' to install.")40 sys.exit(-1)41try:42 import keyring43except ImportError:44 print("Could not find the keyring library. Run 'sudo pip install keyring' to install.")45 sys.exit(-1)46try:47 import jira.client48except ImportError:49 print("Could not find jira-python library; exiting. Run 'sudo pip install jira' to install.")50 sys.exit(-1)51 52JIRA_BASE = "https://issues.apache.org/jira/browse"53JIRA_API_BASE = "https://issues.apache.org/jira"54TMP_CREDENTIALS = {}55def register(username, password):56 """ Use this function to register a JIRA account in your OS' keyring """57 keyring.set_password('gobblin-pr', username, password)58 59def validate_jira_id(jira_id):60 if not jira_id:61 return62 elif isinstance(jira_id, int):63 return 'GOBBLIN-{}'.format(abs(jira_id))64 # first look for GOBBLIN-X65 ids = re.findall("GOBBLIN-[0-9]{1,6}", jira_id)66 if len(ids) > 1:67 raise click.UsageError('Found multiple issue ids: {}'.format(ids))68 elif len(ids) == 1:69 jira_id = ids[0]70 elif not ids:71 # if we don't find GOBBLIN-X, see if jira_id is an int72 try:73 jira_id = 'GOBBLIN-{}'.format(abs(int(jira_id)))74 except ValueError:75 raise click.UsageError(76 'JIRA id must be an integer or have the form GOBBLIN-X')77 return jira_id78def update_jira_issue(fix_version):79 """80 Update JIRA issue81 fix_version: the version to assign to the Gobblin JIRAs.82 """83 # ASF JIRA username84 JIRA_USERNAME = os.environ.get("JIRA_USERNAME", '')85 if not JIRA_USERNAME:86 JIRA_USERNAME = TMP_CREDENTIALS.get('JIRA_USERNAME', '')87 # ASF JIRA password88 JIRA_PASSWORD = os.environ.get("JIRA_PASSWORD", '')89 if not JIRA_PASSWORD:90 JIRA_PASSWORD = TMP_CREDENTIALS.get('JIRA_PASSWORD', '')91 if not JIRA_USERNAME:92 JIRA_USERNAME = click.prompt(93 click.style('Username for Gobblin JIRA', fg='blue', bold=True),94 type=str)95 click.echo(96 'Set a JIRA_USERNAME env var to avoid this prompt in the future.')97 TMP_CREDENTIALS['JIRA_USERNAME'] = JIRA_USERNAME98 if JIRA_USERNAME and not JIRA_PASSWORD:99 JIRA_PASSWORD = keyring.get_password("gobblin-pr", JIRA_USERNAME)100 if JIRA_PASSWORD:101 click.echo("Obtained password from keyring. To reset remove it there.")102 if not JIRA_PASSWORD:103 JIRA_PASSWORD = click.prompt(104 click.style('Password for Gobblin JIRA', fg='blue', bold=True),105 type=str,106 hide_input=True)107 if JIRA_USERNAME and JIRA_PASSWORD:108 if click.confirm(click.style("Would you like to store your password "109 "in your keyring?", fg='blue', bold=True)):110 register(JIRA_USERNAME, JIRA_PASSWORD)111 TMP_CREDENTIALS['JIRA_PASSWORD'] = JIRA_PASSWORD112 try:113 asf_jira = jira.client.JIRA(114 {'server': JIRA_API_BASE},115 basic_auth=(JIRA_USERNAME, JIRA_PASSWORD))116 except:117 raise ValueError('Could not log in to JIRA!')118 119 for jira_obj in asf_jira.search_issues('filter=12342798', startAt=0, maxResults=2000):120 jira_id = jira_obj.key121 click.echo("Processing JIRA: %s" % jira_id)122 123 try:124 issue = asf_jira.issue(jira_id)125 fixVersions = []126 for version in issue.fields.fixVersions:127 fixVersions.append({'name': version.name})128 fixVersions.append({'name': fix_version})129 issue.update(fields={'fixVersions': fixVersions})130 except Exception as e:131 raise ValueError(132 "ASF JIRA could not find issue {}\n{}".format(jira_id, e))133 134def update_jira_issues():135 fix_version = click.prompt(136 click.style(137 "Enter fix version", fg='blue', bold=True),138 default=None)139 140 if fix_version is None:141 raise click.UsageError('No fix version specified')142 143 update_jira_issue(144 fix_version=fix_version)145 146if __name__ == "__main__":147 try:148 update_jira_issues()149 except:...

Full Screen

Full Screen

jira_ui.py

Source:jira_ui.py Github

copy

Full Screen

1from selenium_ui.jira import modules2from extension.jira import extension_ui # noqa F4013# this action should be the first one4def test_0_selenium_a_login(jira_webdriver, jira_datasets, jira_screen_shots):5 modules.login(jira_webdriver, jira_datasets)6def test_1_selenium_browse_projects_list(jira_webdriver, jira_datasets, jira_screen_shots):7 modules.browse_projects_list(jira_webdriver, jira_datasets)8def test_1_selenium_browse_boards_list(jira_webdriver, jira_datasets, jira_screen_shots):9 modules.browse_boards_list(jira_webdriver, jira_datasets)10def test_1_selenium_create_issue(jira_webdriver, jira_datasets, jira_screen_shots):11 modules.create_issue(jira_webdriver, jira_datasets)12def test_1_selenium_edit_issue(jira_webdriver, jira_datasets, jira_screen_shots):13 modules.edit_issue(jira_webdriver, jira_datasets)14def test_1_selenium_save_comment(jira_webdriver, jira_datasets, jira_screen_shots):15 modules.save_comment(jira_webdriver, jira_datasets)16def test_1_selenium_search_jql(jira_webdriver, jira_datasets, jira_screen_shots):17 modules.search_jql(jira_webdriver, jira_datasets)18def test_1_selenium_view_backlog_for_scrum_board(jira_webdriver, jira_datasets, jira_screen_shots):19 modules.view_backlog_for_scrum_board(jira_webdriver, jira_datasets)20def test_1_selenium_view_scrum_board(jira_webdriver, jira_datasets, jira_screen_shots):21 modules.view_scrum_board(jira_webdriver, jira_datasets)22def test_1_selenium_view_kanban_board(jira_webdriver, jira_datasets, jira_screen_shots):23 modules.view_kanban_board(jira_webdriver, jira_datasets)24def test_1_selenium_view_dashboard(jira_webdriver, jira_datasets, jira_screen_shots):25 modules.view_dashboard(jira_webdriver, jira_datasets)26def test_1_selenium_view_issue(jira_webdriver, jira_datasets, jira_screen_shots):27 modules.view_issue(jira_webdriver, jira_datasets)28def test_1_selenium_view_project_summary(jira_webdriver, jira_datasets, jira_screen_shots):29 modules.view_project_summary(jira_webdriver, jira_datasets)30"""31Add custom actions anywhere between login and log out action. Move this to a different line as needed.32Write your custom selenium scripts in `app/extension/jira/extension_ui.py`.33Refer to `app/selenium_ui/jira/modules.py` for examples.34"""35def test_1_selenium_view_bind_unleash_toggle(jira_webdriver, jira_datasets, jira_screen_shots):36 extension_ui.app_specific_action(jira_webdriver, jira_datasets)37# this action should be the last one38def test_2_selenium_z_log_out(jira_webdriver, jira_datasets, jira_screen_shots):...

Full Screen

Full Screen

jira_issue.py

Source:jira_issue.py Github

copy

Full Screen

1import os2from datetime import datetime3from typing import Optional, List4import arrow5from app.models.jira.jira_component import JiraComponent6from app.models.jira.jira_epic import JiraEpic7from app.models.jira.jira_issue_type import JiraIssueType8from app.models.jira.jira_project import JiraProject9from app.models.jira.jira_resolution import JiraResolution10from app.models.jira.jira_status import JiraStatus11from app.models.jira.jira_status_category import JiraStatusCategory12class JiraIssue:13 key: str = ''14 summary: str = ''15 status: Optional[JiraStatus] = None16 status_category: Optional[JiraStatusCategory] = None17 story_points: Optional[float] = None18 issue_type: Optional[JiraIssueType] = None19 resolution: Optional[JiraResolution] = None20 resolution_date: Optional[datetime] = None21 components: Optional[List[JiraComponent]] = None22 parent: Optional[JiraEpic] = None23 project: Optional[JiraProject] = None24 def __init__(self, raw: dict):25 self.key = raw['key']26 self.issue_type = JiraIssueType(raw['fields']['issuetype'])27 self.summary = raw['fields']['summary']28 if raw['fields']['status']:29 self.status = JiraStatus(raw['fields']['status'])30 if raw['fields']['status']['statusCategory']:31 self.status_category = JiraStatusCategory(raw['fields']['status']['statusCategory'])32 if raw['fields']['customfield_10014']:33 self.story_points = raw['fields']['customfield_10014']34 if raw['fields']['resolution']:35 self.resolution = JiraResolution(raw['fields']['resolution'])36 if raw['fields']['resolutiondate']:37 parsed_data = arrow.get(raw['fields']['resolutiondate'])38 self.resolution_date = parsed_data.datetime39 if raw['fields']['components']:40 self.components = []41 for component in raw['fields']['components']:42 self.components.append(JiraComponent(component))43 try:44 if raw['fields']['parent'] and not self.issue_type.subtask:45 self.parent = JiraEpic(raw['fields']['parent'])46 except KeyError:47 self.parent = None48 if raw['fields']['project']:49 self.project = JiraProject(raw['fields']['project'])50 @property51 def url(self) -> str:...

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 toolium 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