How to use test_bug_id_from_url method in Kiwi

Best Python code snippet using Kiwi_python

test_openproject.py

Source:test_openproject.py Github

copy

Full Screen

...36 base_url="http://bugtracker.kiwitcms.org",37 api_password="26210315639327b10b56b7ef5d2f47f843c0ced3bafd1540fd4ecb30a06fa80f",38 )39 self.integration = OpenProject(bug_system, None)40 def test_bug_id_from_url(self):41 result = self.integration.bug_id_from_url(self.existing_bug_url)42 self.assertEqual(self.existing_bug_id, result)43 def test_details(self):44 result = self.integration.details(self.existing_bug_url)45 self.assertEqual("NEW TASK: Setup conference website", result["title"])46 self.assertEqual("", result["description"])47 def test_auto_update_bugtracker(self):48 last_comment = None49 initial_comments = self.integration.rpc.get_comments(self.existing_bug_id)50 # simulate user adding a new bug URL to a TE and clicking51 # 'Automatically update bug tracker'52 result = self.rpc_client.TestExecution.add_link(53 {54 "execution_id": self.execution_1.pk,55 "is_defect": True,56 "url": self.existing_bug_url,57 },58 True,59 )60 # making sure RPC above returned the same URL61 self.assertEqual(self.existing_bug_url, result["url"])62 # wait until comments have been refreshed b/c this seem to happen async63 initial_comments_length = initial_comments["count"]64 current_comments_length = initial_comments_length65 while current_comments_length != initial_comments_length + 1:66 comments = self.integration.rpc.get_comments(self.existing_bug_id)67 current_comments_length = comments["count"]68 last_comment = comments["_embedded"]["elements"][-1]69 # assert that a comment has been added as the last one70 # and also verify its text71 for expected_string in [72 "Confirmed via test execution",73 f"TR-{self.execution_1.run_id}: {self.execution_1.run.summary}",74 self.execution_1.run.get_full_url(),75 f"TE-{self.execution_1.pk}: {self.execution_1.case.summary}",76 ]:77 self.assertIn(expected_string, last_comment["comment"]["raw"])78 def test_report_issue_from_test_execution_1click_works(self):79 # simulate user clicking the 'Report bug' button in TE widget, TR page80 result = self.rpc_client.Bug.report(81 self.execution_1.pk, self.integration.bug_system.pk82 )83 self.assertEqual(result["rc"], 0)84 self.assertIn(self.integration.bug_system.base_url, result["response"])85 self.assertIn("/work_packages/", result["response"])86 new_issue_id = self.integration.bug_id_from_url(result["response"])87 issue = self.integration.rpc.get_workpackage(new_issue_id)88 self.assertEqual(89 f"Failed test: {self.execution_1.case.summary}",90 issue["subject"],91 )92 for expected_string in [93 f"Filed from execution {self.execution_1.get_full_url()}",94 "Reporter",95 self.execution_1.run.plan.product.name,96 self.component.name,97 "Steps to reproduce",98 self.execution_1.case.text,99 ]:100 self.assertIn(expected_string, issue["description"]["raw"])101 # verify that LR has been added to TE102 self.assertTrue(103 LinkReference.objects.filter(104 execution=self.execution_1,105 url=result["response"],106 is_defect=True,107 ).exists()108 )109 def test_report_issue_with_overriden_workpackage_type_name(self):110 with override_settings(OPENPROJECT_WORKPACKAGE_TYPE_NAME="Epic"):111 # simulate user clicking the 'Report bug' button in TE widget, TR page112 result = self.rpc_client.Bug.report(113 self.execution_1.pk, self.integration.bug_system.pk114 )115 self.assertEqual(result["rc"], 0)116 self.assertIn(self.integration.bug_system.base_url, result["response"])117 self.assertIn("/work_packages/", result["response"])118 new_issue_id = self.integration.bug_id_from_url(result["response"])119 issue = self.integration.rpc.get_workpackage(new_issue_id)120 self.assertEqual(issue["_links"]["type"]["title"], "Epic")121class TestOpenProjectInternalImplementation(TestCase):122 @classmethod123 def setUpTestData(cls):124 super().setUpTestData()125 bug_system = BugSystem.objects.create( # nosec:B106:hardcoded_password_funcarg126 name="OpenProject for kiwitcms/trackers-integration",127 tracker_type="trackers_integration.issuetracker.OpenProject",128 base_url="http://bugtracker.kiwitcms.org",129 api_password="26210315639327b10b56b7ef5d2f47f843c0ced3bafd1540fd4ecb30a06fa80f",130 )131 cls.openproject = OpenProject(bug_system, None)132 @parameterized.expand(133 [134 (135 "no_project_prefix_no_activity_suffix",136 "http://bugtracker.kiwitcms.org/work_packages/8",137 ),138 (139 "no_project_prefix_yes_activity_suffix",140 "http://bugtracker.kiwitcms.org/work_packages/8/activity",141 ),142 (143 "yes_project_prefix_no_activity_suffix",144 "http://bugtracker.kiwitcms.org/projects/demo-project/work_packages/8",145 ),146 (147 "yes_project_prefix_yes_activity_suffix",148 "http://bugtracker.kiwitcms.org/projects/demo-project/work_packages/8/activity",149 ),150 ]151 )152 def test_bug_id_from_url(self, _name, existing_bug_url):153 result = self.openproject.bug_id_from_url(existing_bug_url)154 self.assertEqual(result, 8)155 def test_workpackage_type_with_name_match(self):156 project = self.openproject.get_project_by_name("Scrum project")157 result = self.openproject.get_workpackage_type(project["id"], "Bug")158 # Scrum project has Bug159 self.assertEqual(result["name"], "Bug")160 def test_workpackage_type_fallback_to_first(self):161 project = self.openproject.get_project_by_name("Demo project")162 result = self.openproject.get_workpackage_type(project["id"], "Bug")163 # Demo project doesn't have Bug, but has Task164 self.assertEqual(result["name"], "Task")165 def test_workpackage_type_exception(self):166 with self.assertRaisesRegex(RuntimeError, "WorkPackage Type not found"):...

Full Screen

Full Screen

test_redmine.py

Source:test_redmine.py Github

copy

Full Screen

...30 api_username='admin',31 api_password='admin',32 )33 self.integration = Redmine(bug_system, None)34 def test_bug_id_from_url(self):35 result = self.integration.bug_id_from_url(self.existing_bug_url)36 self.assertEqual(self.existing_bug_id, result)37 def test_details_for_url(self):38 result = self.integration.details(self.existing_bug_url)39 self.assertEqual('Hello Redmine', result['title'])40 self.assertEqual('Created via API', result['description'])41 def test_auto_update_bugtracker(self):42 issue = self.integration.rpc.issue.get(self.existing_bug_id)43 # make sure there are no comments to confuse the test44 initial_comments_count = 045 for comment in issue.journals:46 initial_comments_count += 147 self.assertNotIn(self.execution_1.run.summary, comment.notes)48 # simulate user adding a new bug URL to a TE and clicking...

Full Screen

Full Screen

test_kiwitcms.py

Source:test_kiwitcms.py Github

copy

Full Screen

...34 tracker_type='tcms.issuetracker.types.KiwiTCMS',35 base_url=self.base_url36 )37 self.integration = KiwiTCMS(bug_system, None)38 def test_bug_id_from_url(self):39 result = self.integration.bug_id_from_url(self.existing_bug.get_full_url())40 self.assertEqual(self.existing_bug.pk, result)41 def test_details_for_url(self):42 result = self.integration.details(self.existing_bug.get_full_url())43 self.assertEqual(self.existing_bug.summary, result['title'])44 expected_description = render_to_string(45 'include/bug_details.html',46 {'object': self.existing_bug})47 self.assertEqual(expected_description, result['description'])48 def test_auto_update_bugtracker(self):49 # make sure bug is not associated with execution50 self.assertFalse(51 self.existing_bug.executions.filter(pk=self.execution_1.pk).exists())52 # simulate user adding a new bug URL to a TE and clicking...

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