|
188 | 188 | {'step_number': '7', 'actions': 'action 7 createTestCaseSteps.create', 'execution_type': '2', 'active': '1', 'id': '8157', 'expected_results': 'create - cause step 7 not yet exist'},
|
189 | 189 | {'step_number': '8', 'actions': 'action 8 createTestCaseSteps.update', 'execution_type': '2', 'active': '1', 'id': '8158', 'expected_results': 'create - cause step 8 not yet exist'}],
|
190 | 190 | 'author_id': '1'},
|
191 |
| - {'node_order': '1', 'is_open': '1', |
| 191 | + {'node_order': '1', 'is_open': '1', |
192 | 192 | 'keywords': {'2': {'keyword_id': '2', 'notes': 'another key word', 'testcase_id': '8159', 'keyword': 'KeyWord02'}},
|
193 | 193 | 'id': '8159', 'node_type_id': '3', 'layout': '1', 'tc_external_id': '3', 'parent_id': '8134', 'version': '1',
|
194 | 194 | 'details': '<p>\n\tDetails of the Test Suite B</p>\n', 'estimated_exec_duration': '3.00', 'updater_id': '2', 'status': '1',
|
|
199 | 199 | 'steps': [{'step_number': '1', 'actions': '<p>\n\tStep action 1 -b2</p>\n', 'execution_type': '2', 'active': '1', 'id': '8161', 'expected_results': '<p>\n\tStep result 1 - b2</p>\n'},
|
200 | 200 | {'step_number': '2', 'actions': '<p>\n\tStep action 2 -b2</p>\n', 'execution_type': '2', 'active': '1', 'id': '8162', 'expected_results': '<p>\n\tStep result 2 - b2</p>\n'}],
|
201 | 201 | 'author_id': '2'},
|
202 |
| - {'node_order': '2', 'is_open': '1', |
| 202 | + {'node_order': '2', 'is_open': '1', |
203 | 203 | 'id': '8169', 'node_type_id': '3', 'layout': '1', 'tc_external_id': '4', 'parent_id': '8134', 'version': '1',
|
204 | 204 | 'details': '<p>\n\tDetails of the Test Suite B</p>\n', 'estimated_exec_duration': '3.00', 'updater_id': '2', 'status': '1',
|
205 | 205 | 'importance': '3', 'modification_ts': '2014-07-02 21:02:23', 'execution_type': '1',
|
|
208 | 208 | 'summary': '<p>\n\tThis is the summary of the Test Case B3</p>\n',
|
209 | 209 | 'steps': [{'step_number': '1', 'actions': '<p>\n\tStep action 1 -b3</p>\n', 'execution_type': '2', 'active': '1', 'id': '8171', 'expected_results': '<p>\n\tStep result 1 - b3</p>\n'},
|
210 | 210 | {'step_number': '2', 'actions': '<p>\n\tStep action 2 -b3</p>\n', 'execution_type': '2', 'active': '1', 'id': '8172', 'expected_results': '<p>\n\tStep result 2 - b3</p>\n'}],
|
211 |
| - 'author_id': '2'}] |
212 |
| - } |
| 211 | + 'author_id': '2'}], |
| 212 | + |
| 213 | + '4711' : [{'node_order': '0', 'is_open': '1', |
| 214 | + 'keywords': {'1': {'keyword_id': '1', 'notes': 'a key word', 'testcase_id': '8144', 'keyword': 'KeyWord01'}, |
| 215 | + '3': {'keyword_id': '3', 'notes': 'a third key word', 'testcase_id': '8144', 'keyword': 'KeyWord03'}}, |
| 216 | + 'id': '8144', 'node_type_id': '3', 'layout': '1', 'tc_external_id': '2', 'parent_id': '8134', 'version': '1', |
| 217 | + 'details': '<p>\n\tDetails of the Test Suite B</p>\n', 'estimated_exec_duration': '3.00', 'updater_id': '2', 'status': '1', |
| 218 | + 'importance': '3', 'modification_ts': '2014-06-30 20:45:40', 'execution_type': '1', |
| 219 | + 'preconditions': '<p>\n\tthese are the preconditions</p>\n', 'active': '1', 'creation_ts': '2014-06-28 22:06:17', |
| 220 | + 'node_table': 'testcases', 'tcversion_id': '8145', 'name': 'TESTCASE_B', |
| 221 | + 'summary': '<p>\n\tThis is the summary of the Test Case B</p>\n', |
| 222 | + 'steps': [{'step_number': '1', 'actions': 'Step action 1 -b ', 'execution_type': '2', 'active': '1', 'id': '8151', 'expected_results': 'Step result 1 - b'}], |
| 223 | + 'author_id': '1'} ], |
| 224 | + |
| 225 | + 'noKeywords' : [{'node_order': '0', 'is_open': '1', |
| 226 | + 'id': '8144', 'node_type_id': '3', 'layout': '1', 'tc_external_id': '2', 'parent_id': '8134', 'version': '1', |
| 227 | + 'details': '<p>\n\tDetails of the Test Suite B</p>\n', 'estimated_exec_duration': '3.00', 'updater_id': '2', 'status': '1', |
| 228 | + 'importance': '3', 'modification_ts': '2014-06-30 20:45:40', 'execution_type': '1', |
| 229 | + 'preconditions': '<p>\n\tthese are the preconditions</p>\n', 'active': '1', 'creation_ts': '2014-06-28 22:06:17', |
| 230 | + 'node_table': 'testcases', 'tcversion_id': '8145', 'name': 'TESTCASE_B', |
| 231 | + 'summary': '<p>\n\tThis is the summary of the Test Case B</p>\n', |
| 232 | + 'steps': [{'step_number': '1', 'actions': 'Step action 1 -b ', 'execution_type': '2', 'active': '1', 'id': '8151', 'expected_results': 'Step result 1 - b'}], |
| 233 | + 'author_id': '1'} ] |
| 234 | + |
| 235 | + }, |
| 236 | + 'getTestCase' : { |
| 237 | + '8144' : [{'full_tc_external_id': 'NPROAPI-2', 'id': '8145', 'tc_external_id': '2', 'version': '1', |
| 238 | + 'testsuite_id': 'deepFalse3', 'testcase_id': '8144', 'name': 'TESTCASE_B'}], |
| 239 | + 'NPROAPI-2' : [{'full_tc_external_id': 'NPROAPI-2', 'id': '8145', 'tc_external_id': '2', 'version': '1', |
| 240 | + 'testsuite_id': 'deepFalse3', 'testcase_id': '8144', 'name': 'TESTCASE_B'}], |
| 241 | + '8159' : [{'full_tc_external_id': 'NPROAPI-3', 'id': '8160', 'tc_external_id': '3', 'version': '1', |
| 242 | + 'testsuite_id': 'deepFalse3', 'testcase_id': '8159', 'name': 'TESTCASE_B2'}], |
| 243 | + 'NPROAPI-3' : [{'full_tc_external_id': 'NPROAPI-3', 'id': '8160', 'tc_external_id': '3', 'version': '1', |
| 244 | + 'testsuite_id': 'deepFalse3', 'testcase_id': '8159', 'name': 'TESTCASE_B2'}], |
| 245 | + '8169' : [{'full_tc_external_id': 'NPROAPI-4', 'id': '8170', 'tc_external_id': '3', 'version': '1', |
| 246 | + 'testsuite_id': 'deepFalse3', 'testcase_id': '8169', 'name': 'TESTCASE_B3'}], |
| 247 | + 'NPROAPI-4' : [{'full_tc_external_id': 'NPROAPI-4', 'id': '8170', 'tc_external_id': '3', 'version': '1', |
| 248 | + 'testsuite_id': 'deepFalse3', 'testcase_id': '8169', 'name': 'TESTCASE_B3'}] } |
213 | 249 | }
|
214 | 250 |
|
215 | 251 |
|
@@ -245,7 +281,14 @@ def _callServer(self, methodAPI, argsAPI=None):
|
245 | 281 | elif methodAPI in ['getTestCaseIDByName']:
|
246 | 282 | response = data[argsAPI['testcasename']]
|
247 | 283 | elif methodAPI in ['getTestCase']:
|
248 |
| - response = data['%(testcaseid)s-%(version)s' % argsAPI] |
| 284 | + datakey = argsAPI.get('testcaseid') |
| 285 | + if datakey: |
| 286 | + datakey = str(datakey) |
| 287 | + else: |
| 288 | + datakey = argsAPI.get('testcaseexternalid', '') |
| 289 | + if argsAPI.has_key('version'): |
| 290 | + datakey += '-%(version)s' % argsAPI |
| 291 | + response = data[datakey] |
249 | 292 | elif methodAPI in ['getFullPath']:
|
250 | 293 | response = data[argsAPI['nodeid']]
|
251 | 294 | elif methodAPI in ['getTestProjectByName']:
|
@@ -472,6 +515,57 @@ def test_whatArgs_getTestCasesForTestSuite(self):
|
472 | 515 | argsDescription = self.api.whatArgs('getTestCasesForTestSuite')
|
473 | 516 | self.assertIn('getkeywords=<getkeywords>', argsDescription)
|
474 | 517 |
|
| 518 | + def test_listKeywordsForTC_FullExternalId(self): |
| 519 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 520 | + response = self.api.listKeywordsForTC('NPROAPI-2') |
| 521 | + self.assertEqual(['KeyWord01', 'KeyWord03'], response) |
| 522 | + |
| 523 | + def test_listKeywordsForTC_InternalId_Int(self): |
| 524 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 525 | + response = self.api.listKeywordsForTC(8144) |
| 526 | + self.assertEqual(['KeyWord01', 'KeyWord03'], response) |
| 527 | + |
| 528 | + def test_listKeywordsForTC_InternalId_String(self): |
| 529 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 530 | + response = self.api.listKeywordsForTC('8144') |
| 531 | + self.assertEqual(['KeyWord01', 'KeyWord03'], response) |
| 532 | + |
| 533 | + def test_listKeywordsForTC_One(self): |
| 534 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 535 | + response = self.api.listKeywordsForTC('NPROAPI-3') |
| 536 | + self.assertEqual(['KeyWord02'], response) |
| 537 | + |
| 538 | + def test_listKeywordsForTC_None(self): |
| 539 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 540 | + response = self.api.listKeywordsForTC('NPROAPI-4') |
| 541 | + self.assertEqual([], response) |
| 542 | + |
| 543 | + def test_listKeywordsForTS_NoneTC(self): |
| 544 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 545 | + response = self.api.listKeywordsForTS('noTestCase') |
| 546 | + self.assertEqual({}, response) |
| 547 | + |
| 548 | + def test_listKeywordsForTS_NoneKW(self): |
| 549 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 550 | + response = self.api.listKeywordsForTS('noKeywords') |
| 551 | + self.assertEqual({'8144' : []}, response) |
| 552 | + |
| 553 | + def test_listKeywordsForTS_Id_Int(self): |
| 554 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 555 | + response = self.api.listKeywordsForTS(4711) |
| 556 | + self.assertEqual({'8144' : ['KeyWord01', 'KeyWord03']}, response) |
| 557 | + |
| 558 | + def test_listKeywordsForTS_Id_String(self): |
| 559 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 560 | + response = self.api.listKeywordsForTS('4711') |
| 561 | + self.assertEqual({'8144' : ['KeyWord01', 'KeyWord03']}, response) |
| 562 | + |
| 563 | + def test_listKeywordsForTS_Multi(self): |
| 564 | + self.api.loadScenario(SCENARIO_KEYWORDS) |
| 565 | + response = self.api.listKeywordsForTS('deepFalse3') |
| 566 | + self.assertEqual({'8144' : ['KeyWord01', 'KeyWord03'], |
| 567 | + '8159' : ['KeyWord02'], '8169' : []}, response) |
| 568 | + |
475 | 569 |
|
476 | 570 |
|
477 | 571 | if __name__ == "__main__":
|
|
0 commit comments