@@ 12-44 (lines=33) @@ | ||
9 | from tcms.tests import BaseCaseRun |
|
10 | ||
11 | ||
12 | class Test_TestRunReportUnconfiguredJIRA(BaseCaseRun): |
|
13 | """ |
|
14 | When JIRA isn't fully configured, i.e. missing API URL |
|
15 | Username and Password/Token this leads to errors when |
|
16 | generating TR reports. See |
|
17 | https://github.com/kiwitcms/Kiwi/issues/100 |
|
18 | ||
19 | The problem is the underlying JIRA client assumes default |
|
20 | values and tries to connect to the JIRA instance upon |
|
21 | object creation! |
|
22 | """ |
|
23 | ||
24 | @classmethod |
|
25 | def setUpTestData(cls): |
|
26 | super(Test_TestRunReportUnconfiguredJIRA, cls).setUpTestData() |
|
27 | ||
28 | # NOTE: base_url, api_url, api_username and api_password |
|
29 | # are intentionally left blank! |
|
30 | cls.it = BugSystem.objects.create( |
|
31 | name='Partially configured JIRA', |
|
32 | url_reg_exp='https://jira.example.com/browse/%s', |
|
33 | validate_reg_exp=r'^[A-Z0-9]+-\d+$', |
|
34 | tracker_type='JIRA' |
|
35 | ) |
|
36 | ||
37 | cls.execution_1.add_bug('KIWI-1234', cls.it.pk) |
|
38 | ||
39 | def test_reports(self): |
|
40 | url = reverse('run-report', args=[self.execution_1.run_id]) |
|
41 | response = self.client.get(url) |
|
42 | ||
43 | self.assertEqual(HTTPStatus.OK, response.status_code) |
|
44 | self.assertContains(response, self.it.url_reg_exp % 'KIWI-1234') |
|
45 | ||
46 | ||
47 | class Test_TestRunReportUnconfiguredBugzilla(BaseCaseRun): |
|
@@ 107-132 (lines=26) @@ | ||
104 | self.assertContains(response, self.it.url_reg_exp % '5678') |
|
105 | ||
106 | ||
107 | class Test_TestRunReportUnconfiguredGitHub(BaseCaseRun): |
|
108 | """ |
|
109 | Test for https://github.com/kiwitcms/Kiwi/issues/100 |
|
110 | """ |
|
111 | ||
112 | @classmethod |
|
113 | def setUpTestData(cls): |
|
114 | super(Test_TestRunReportUnconfiguredGitHub, cls).setUpTestData() |
|
115 | ||
116 | # NOTE: base_url, api_url, api_username and api_password |
|
117 | # are intentionally left blank! |
|
118 | cls.it = BugSystem.objects.create( |
|
119 | name='Partially configured GitHub', |
|
120 | url_reg_exp='https://github.com/kiwitcms/Kiwi/issues/%s', |
|
121 | validate_reg_exp=r'^\d+$', |
|
122 | tracker_type='GitHub' |
|
123 | ) |
|
124 | ||
125 | cls.execution_1.add_bug('100', cls.it.pk) |
|
126 | ||
127 | def test_reports(self): |
|
128 | url = reverse('run-report', args=[self.execution_1.run_id]) |
|
129 | response = self.client.get(url) |
|
130 | ||
131 | self.assertEqual(HTTPStatus.OK, response.status_code) |
|
132 | self.assertContains(response, self.it.url_reg_exp % '100') |
|
133 | ||
@@ 47-72 (lines=26) @@ | ||
44 | self.assertContains(response, self.it.url_reg_exp % 'KIWI-1234') |
|
45 | ||
46 | ||
47 | class Test_TestRunReportUnconfiguredBugzilla(BaseCaseRun): |
|
48 | """ |
|
49 | Test for https://github.com/kiwitcms/Kiwi/issues/100 |
|
50 | """ |
|
51 | ||
52 | @classmethod |
|
53 | def setUpTestData(cls): |
|
54 | super(Test_TestRunReportUnconfiguredBugzilla, cls).setUpTestData() |
|
55 | ||
56 | # NOTE: base_url, api_url, api_username and api_password |
|
57 | # are intentionally left blank! |
|
58 | cls.it = BugSystem.objects.create( |
|
59 | name='Partially configured Bugzilla', |
|
60 | url_reg_exp='https://bugzilla.example.com/show_bug.cgi?id=%s', |
|
61 | validate_reg_exp=r'^\d{1,7}$', |
|
62 | tracker_type='Bugzilla' |
|
63 | ) |
|
64 | ||
65 | cls.execution_1.add_bug('5678', cls.it.pk) |
|
66 | ||
67 | def test_reports(self): |
|
68 | url = reverse('run-report', args=[self.execution_1.run_id]) |
|
69 | response = self.client.get(url) |
|
70 | ||
71 | self.assertEqual(HTTPStatus.OK, response.status_code) |
|
72 | self.assertContains(response, self.it.url_reg_exp % '5678') |
|
73 | ||
74 | ||
75 | class Test_TestRunReportConfiguredBugzilla(BaseCaseRun): |