How to use related_bug method in tempest

Best Python code snippet using tempest_python

test_bugs.py

Source:test_bugs.py Github

copy

Full Screen

...117 self.assertEqual([expected_bug_data], bug_data)118 def test_getBugData(self):119 # The getBugData method works as expected without a related_bug.120 self._assert_getBugData()121 def test_getBugData_with_related_bug(self):122 # The getBugData method works as expected if related bug is specified.123 related_bug = self.factory.makeBug()124 self._assert_getBugData(related_bug)125 def test_createBug_public_bug_sharing_policy_public(self):126 # createBug() does not adapt the default kwargs when they are none.127 product = self.factory.makeProduct()128 with person_logged_in(product.owner):129 product.setBugSharingPolicy(BugSharingPolicy.PUBLIC)130 bug = self.application.createBug(131 product.owner, 'title', 'description', product)132 self.assertEqual(InformationType.PUBLIC, bug.information_type)133 def test_createBug_default_sharing_policy_proprietary(self):134 # createBug() does not adapt the default kwargs when they are none.135 product = self.factory.makeProduct(...

Full Screen

Full Screen

Jira_items_linker.py

Source:Jira_items_linker.py Github

copy

Full Screen

1from jira import JIRA2import settings3def get_related_bugs(WordPress_url: str) -> list:4 return_value = list()5 jira = JIRA(settings.JIRA_URL, basic_auth=(settings.JIRA_USERNAME, settings.JIRA_PASSWORD))6 bugs_related_to_this_site_jql = 'project = WWP AND resolution = Unresolved and text ~"{}/"'.format(WordPress_url)7 bugs_related_to_this_site = jira.search_issues(bugs_related_to_this_site_jql, maxResults=5000)8 for bug_related_to_this_site in bugs_related_to_this_site:9 return_value.append(bug_related_to_this_site.key)10 return return_value11def link_bug_to_site(bug_key: str, site_key: str) -> None:12 print("Linking bug '{}' with site '{}".format(bug_key, site_key))13 jira = JIRA(settings.JIRA_URL, basic_auth=(settings.JIRA_USERNAME, settings.JIRA_PASSWORD))14 jira.create_issue_link(15 type="blocks",16 inwardIssue=bug_key,17 outwardIssue=site_key,18 comment={19 "body": "Linking '%s' --> '%s'" % (bug_key, site_key),20 }21 )22def issue_is_still_open(key: str) -> bool:23 print("Checking bug status for {}".format(key))24 jira = JIRA(settings.JIRA_URL, basic_auth=(settings.JIRA_USERNAME, settings.JIRA_PASSWORD))25 issue = jira.issue(key)26 current_status = str(issue.fields.status)27 return_value = (current_status != 'Done')28 return return_value29def transition_site(key: str, new_status: str) -> None:30 print("Transitioning {} with '{}'...".format(key, new_status), end='')31 jira = JIRA(settings.JIRA_URL, basic_auth=(settings.JIRA_USERNAME, settings.JIRA_PASSWORD))32 site = jira.issue(key)33 transitions = jira.transitions(site)34 for t in transitions:35 if t['name'] == new_status:36 jira.transition_issue(issue=site, transition=t['id'])37 print('done')38def link_bugs_with_sites():39 # Connect to the Jira instance40 jira = JIRA(settings.JIRA_URL, basic_auth=(settings.JIRA_USERNAME, settings.JIRA_PASSWORD))41 # Search for the issues wiating for feedback using JQL42 sites_awaiting_for_wm_feedback_jql = 'project = WPFEEDBACK AND issuetype = Story AND status != Done'43 sites_awaiting_for_wm_feedback = jira.search_issues(sites_awaiting_for_wm_feedback_jql, maxResults=5000)44 for site_awaiting_for_wm_feedback in sites_awaiting_for_wm_feedback:45 print('Checking links for {}'.format(site_awaiting_for_wm_feedback.key))46 related_bugs = get_related_bugs(site_awaiting_for_wm_feedback.fields.customfield_10501)47 # Make sure we do not duplicate work48 for related_bug in related_bugs:49 should_be_skipped = False50 for linked_issue in site_awaiting_for_wm_feedback.fields.issuelinks:51 if hasattr(linked_issue, 'inwardIssue') and linked_issue.inwardIssue.key == related_bug:52 should_be_skipped = True53 break54 if hasattr(linked_issue, 'outwardIssue') and linked_issue.outwardIssue.key == related_bug:55 should_be_skipped = True56 break57 if not should_be_skipped:58 link_bug_to_site(related_bug, site_awaiting_for_wm_feedback.key)59def transition_sites_having_open_bugs():60 # Connect to the Jira instance61 jira = JIRA(settings.JIRA_URL, basic_auth=(settings.JIRA_USERNAME, settings.JIRA_PASSWORD))62 # Search for the issues wiating for feedback using JQL63 sites_awaiting_for_wm_feedback_jql = 'project = WPFEEDBACK and status = "En attente de feedback" and issuetype = Story'64 sites_awaiting_for_wm_feedback = jira.search_issues(sites_awaiting_for_wm_feedback_jql, maxResults=5000)65 for site_awaiting_for_wm_feedback in sites_awaiting_for_wm_feedback:66 print("Checking transition for {}".format(site_awaiting_for_wm_feedback.key))67 should_be_transitioned = False68 for issue_link in site_awaiting_for_wm_feedback.fields.issuelinks:69 still_open = False70 if hasattr(issue_link, 'outwardIssue'):71 still_open = issue_is_still_open(issue_link.outwardIssue.key)72 else:73 still_open = issue_is_still_open(issue_link.inwardIssue.key)74 if still_open:75 should_be_transitioned = True76 break77 if should_be_transitioned:78 transition_site(site_awaiting_for_wm_feedback.key, 'Contient des bugs')79def transition_sites_waiting_for_fix() -> None:80 # Connect to the Jira instance81 jira = JIRA(settings.JIRA_URL, basic_auth=(settings.JIRA_USERNAME, settings.JIRA_PASSWORD))82 # Search for the issues wiating for feedback using JQL83 sites_having_bugs_jql = 'project = WPFEEDBACK and status = "En attente de correction de Bug" and issuetype = Story'84 sites_having_bugs = jira.search_issues(sites_having_bugs_jql, maxResults=5000)85 for site_having_bugs in sites_having_bugs:86 print("Checking transition for {}".format(site_having_bugs.key))87 should_be_transitioned = True88 for issue_link in site_having_bugs.fields.issuelinks:89 if hasattr(issue_link, 'outwardIssue'):90 still_open = issue_is_still_open(issue_link.outwardIssue.key)91 else:92 still_open = issue_is_still_open(issue_link.inwardIssue.key)93 if still_open:94 should_be_transitioned = False95 break96 if should_be_transitioned:97 transition_site(site_having_bu gs.key, 'A redeployer en QA')98if __name__ == "__main__":99 # Make sure sure that sites are linked to their respective bugs100 link_bugs_with_sites()101 # Now that we know that all bugs and sites are linked correctly102 # it is time to find all the sites supposedly 'waiting for feedback' actually having open bugs attached103 # if it is the case, the site should be transitioned to 'waiting for bug fixing'104 transition_sites_having_open_bugs()105 # Now it's time to review all sites in 'En attente de correction de bug'106 # if they do not have linked bugs that are open, they can be transitioned back107 # to 'A migrer en QA'...

Full Screen

Full Screen

parse.py

Source:parse.py Github

copy

Full Screen

1import string2import ply.lex as lex3import ply.yacc as yacc4from . import config5tokens = (6 'TITLE',7 'CHANGE_ID',8 'IMPLEMENTS',9 'CLOSES_BUG',10 'RELATED_BUG',11 'PARTIAL_BUG',12 'LINE',13 'NEWLINE',14)15t_CHANGE_ID = r'(?i)Change-Id:[^\n]+'16t_IMPLEMENTS = r'(?i)Implements:[^\n]+'17t_CLOSES_BUG = r'(?i)Closes-Bug:[^\n]+'18t_RELATED_BUG = r'(?i)Related-Bug:[^\n]+'19t_PARTIAL_BUG = r'(?i)Partial-Bug:[^\n]+'20t_TITLE = r'^[^\n]+'21t_LINE = r'[^\n]+'22def t_NEWLINE(t):23 r'\n+'24 t.lexer.lineno += len(t.value)25 t.value = '\n'26 return t27def t_error(t):28 pass29def debug(func):30 def _func(p):31 if config.DEBUG:32 print func.__name__33 for i, item in enumerate(p):34 print("before p[%s] = %s" % (i, item))35 result = func(p)36 if config.DEBUG:37 for i, item in enumerate(p):38 print("after p[%s] = %s" % (i, item))39 return result40 _func.__doc__ = func.__doc__41 return _func42@debug43def p_commit_message_title_no_description(p):44 """commit_message : title refs"""45 p[0] = {'title': p[1], 'refs': p[2]}46@debug47def p_commit_message_title_only(p):48 """commit_message : title"""49 p[0] = {'title': p[1]}50@debug51def p_commit_message_no_refs(p):52 """commit_message : title lines"""53 p[0] = {'title': p[1], 'description': p[2]}54@debug55def p_commit_message_description_refs(p):56 """commit_message : title lines refs"""57 p[0] = {'title': p[1], 'description': p[2], 'refs': p[3]}58@debug59def p_title(p):60 """title : TITLE61 | TITLE NEWLINE"""62 p[0] = p[1]63@debug64def p_lines(p):65 """lines : line66 | line lines"""67 if len(p) == 3:68 p[0] = p[1] + p[2]69 else:70 p[0] = p[1]71@debug72def p_line(p):73 """line : LINE74 | LINE NEWLINE"""75 p[0] = p[1]76@debug77def p_refs(p):78 """refs : ref79 | ref refs"""80 if len(p) == 3:81 # p[1] is (reftype, refvalue)82 # p[2] is [(reftype1, refvalue1), (reftype2, refvalue2)]83 p[0] = p[2]84 p[0].append(p[1])85 else:86 # p[0] should be a list of refs87 p[0] = [p[1]]88@debug89def p_refs_lines(p):90 """refs : ref lines91 | ref lines refs"""92 if len(p) == 4:93 p[0] = p[3]94 p[0].append(p[1])95 else:96 p[0] = [p[1]]97@debug98def p_ref(p):99 """ref : CHANGE_ID100 | CHANGE_ID NEWLINE101 | IMPLEMENTS102 | IMPLEMENTS NEWLINE103 | CLOSES_BUG104 | CLOSES_BUG NEWLINE105 | RELATED_BUG106 | RELATED_BUG NEWLINE107 | PARTIAL_BUG108 | PARTIAL_BUG NEWLINE"""109 try:110 reftype, refvalue = p[1].split(':', 1)111 except ValueError:112 return113 p[0] = (string.strip(reftype).lower(), string.strip(refvalue, '# '))114def parse_commit_message(data):115 lexer = lex.lex()116 parser = yacc.yacc()117 if config.DEBUG:118 print("=============================")119 print("raw commit message: \n%s" % data)120 lexer.input(data)121 for tok in lexer:122 print tok123 parsed = parser.parse(data, debug=config.DEBUG_YACC)124 print("parsed commit message: \n%s" % parsed)125 return parsed...

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