Skip to content

Commit f542a17

Browse files
author
Luiko Czub
committed
new api method unassignTestCaseExecutionTask #32
1 parent acddbc3 commit f542a17

File tree

7 files changed

+120
-6
lines changed

7 files changed

+120
-6
lines changed

CHANGES.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@ pull request `#36 <https://github.com/lczub/TestLink-API-Python-client/pull/36>`
1515
- Adds a new --proxy option in command line.
1616
- Recognizes "http_proxy" environment variable.
1717

18-
implement 1.9.13 new api - unassignTestCaseExecutionTask # 32
19-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20-
under develop
18+
implement 1.9.13 new api - unassignTestCaseExecutionTask #32
19+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
21+
new TestlinkAPIGeneric and TestlinkAPIClient api method
22+
23+
- unassignTestCaseExecutionTask(<testplanid>, <testcaseexternalid>,
24+
[buildid=<buildid>], [buildname=<buildname>], [platformid=<platformid>],
25+
[platformname=<platformname>], [user=<loginname>],
26+
[action='unassignAll'|'unassignOne'], [devKey=<devKey>])
27+
28+
examples see `<example/TestLinkExample.py>`_
2129

2230
TestLink-API-Python-client release notes v0.6.0 (Dec. 2014)
2331
------------------------------------------------------------

example/TestLinkExample.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
print("")
113113

114114
# CHANGE this name into a valid account, known in your TL application
115-
myTestUserName="admin"
115+
myTestUserName="pyTLapi"
116116
myTestUserName2="admin"
117117
# get user information
118118
response = myTestLink.getUserByLogin(myTestUserName)
@@ -508,6 +508,33 @@
508508
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B)
509509
print("getTestCaseAssignedTester TC_B TP_B no Platform", response)
510510

511+
# try to remove not assigned tester
512+
response = myTestLink.unassignTestCaseExecutionTask(
513+
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B,
514+
user=myTestUserName2)
515+
print("unassignTestCaseExecutionTask not assigned user", response)
516+
response = myTestLink.getTestCaseAssignedTester(
517+
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B)
518+
print("getTestCaseAssignedTester TC_B TP_B no Platform", response)
519+
520+
# try to remove all assigned tester
521+
response = myTestLink.unassignTestCaseExecutionTask(
522+
newTestPlanID_B, tc_b_full_ext_id, buildid=newBuildID_B,
523+
action='unassignAll')
524+
print("unassignTestCaseExecutionTask unassignAll", response)
525+
response = myTestLink.getTestCaseAssignedTester(
526+
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B)
527+
print("getTestCaseAssignedTester TC_B TP_B no Platform", response)
528+
529+
# reassign user to test case execution tasks - test plans without platforms
530+
response = myTestLink.assignTestCaseExecutionTask( myTestUserName,
531+
newTestPlanID_B, tc_b_full_ext_id, buildid=newBuildID_B)
532+
print("assignTestCaseExecutionTask", response)
533+
response = myTestLink.getTestCaseAssignedTester(
534+
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B)
535+
print("getTestCaseAssignedTester TC_B TP_B no Platform", response)
536+
537+
511538
# TC_B blocked (without platform), explicit build and some notes ,
512539
# TC identified with internal id, report by myTestUserName
513540
newResult = myTestLink.reportTCResult(newTestCaseID_B, newTestPlanID_B, NEWBUILD_B,

example/TestLinkExampleGenericApi.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
print("")
102102

103103
# CHANGE this name into a valid account, known in your TL application
104-
myTestUserName="admin"
104+
myTestUserName="pyTLapi"
105105
myTestUserName2="admin"
106106
# get user information
107107
response = myTestLink.getUserByLogin(myTestUserName)
@@ -433,6 +433,32 @@
433433
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B)
434434
print("getTestCaseAssignedTester TC_B TP_B no Platform", response)
435435

436+
# try to remove not assigned tester
437+
response = myTestLink.unassignTestCaseExecutionTask(
438+
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B,
439+
user=myTestUserName2)
440+
print("unassignTestCaseExecutionTask not assigned user", response)
441+
response = myTestLink.getTestCaseAssignedTester(
442+
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B)
443+
print("getTestCaseAssignedTester TC_B TP_B no Platform", response)
444+
445+
# try to remove all assigned tester
446+
response = myTestLink.unassignTestCaseExecutionTask(
447+
newTestPlanID_B, tc_b_full_ext_id, buildid=newBuildID_B,
448+
action='unassignAll')
449+
print("unassignTestCaseExecutionTask unassignAll", response)
450+
response = myTestLink.getTestCaseAssignedTester(
451+
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B)
452+
print("getTestCaseAssignedTester TC_B TP_B no Platform", response)
453+
454+
# reassign user to test case execution tasks - test plans without platforms
455+
response = myTestLink.assignTestCaseExecutionTask( myTestUserName,
456+
newTestPlanID_B, tc_b_full_ext_id, buildid=newBuildID_B)
457+
print("assignTestCaseExecutionTask", response)
458+
response = myTestLink.getTestCaseAssignedTester(
459+
newTestPlanID_B, tc_b_full_ext_id, buildname=NEWBUILD_B)
460+
print("getTestCaseAssignedTester TC_B TP_B no Platform", response)
461+
436462
# TC_B in test plan b (without platform)
437463
# first try failed (with bug), second blocked - all by user myTestUserName
438464
newResult = myTestLink.reportTCResult(newTestPlanID_B, 'f',

src/testlink/testlinkapigeneric.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,46 @@ def getTestCaseAssignedTester(self):
11581158
build information is general mandatory
11591159
platform information is required, when test plan has assigned platforms
11601160
"""
1161+
# /**
1162+
# * @param struct $args
1163+
# * @param string $args["devKey"]
1164+
# * @param int $args["testplanid"]
1165+
# * @param string $args["testcaseexternalid"] format PREFIX-NUMBER
1166+
# * @param int $args["buildid"] Mandatory => you can provide buildname as alternative
1167+
# * @param int $args["buildname"] Mandatory => you can provide buildid (DB ID) as alternative
1168+
# * @param int $args["platformid"] optional - BECOMES MANDATORY if Test plan has platforms
1169+
# * you can provide platformname as alternative
1170+
# *
1171+
# * @param int $args["platformname"] optional - BECOMES MANDATORY if Test plan has platforms
1172+
# * you can provide platformid as alternative
1173+
# * @param string $args["user'] - login name => tester
1174+
# * - NOT NEEDED f $args['action'] = 'unassignAll'
1175+
# * ¸
1176+
# *
1177+
# */
1178+
# public function unassignTestCaseExecutionTask($args)
1179+
1180+
@decoApiCallAddDevKey
1181+
@decoMakerApiCallWithArgs(['testplanid', 'testcaseexternalid'],
1182+
['buildid', 'buildname', 'platformid', 'platformname',
1183+
'user', 'action'])
1184+
def unassignTestCaseExecutionTask(self):
1185+
""" assigns a user to a test case execution task
1186+
1187+
testplanid test plan id
1188+
testcaseexternalid format PREFIX-NUMBER
1189+
1190+
args variations: buildid - buildname
1191+
platformid - platformname
1192+
user (login name) - action ('unassignAll')
1193+
build information is general mandatory
1194+
platform information is required, when test plan has assigned platforms
1195+
if action=='unassignAll', user information is not needed
1196+
- otherwise, TL itself will set action to 'unassignOne' and expects a
1197+
valid user information (login name => tester)
1198+
1199+
"""
1200+
11611201

11621202
#
11631203
# public methods for general server calls

src/testlink/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
# ------------------------------------------------------------------------
1919

2020
VERSION = '0.6.1-dev32'
21-
TL_RELEASE = 'DEV 1.9.13 (gitorious 78d4f7f)'
21+
TL_RELEASE = 'DEV 1.9.13 (gitorious 0be4cb9)'
2222

test/utest-online/testlinkapi_generic_online_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,12 @@ def test_getTestCaseAssignedTester_unknownID(self):
380380
buildname='build 4713',
381381
platformname='platform 4714')
382382

383+
def test_unassignTestCaseExecutionTask_unknownID(self):
384+
with self.assertRaisesRegex(TLResponseError, '3000.*4711'):
385+
self.client.unassignTestCaseExecutionTask(4711, 'TC-4712',
386+
buildname='build 4713',
387+
platformname='platform 4714',
388+
user='username',action='unassignOne')
383389

384390
if __name__ == "__main__":
385391
#import sys;sys.argv = ['', 'Test.testName']

test/utest-online/testlinkapi_online_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,13 @@ def test_getTestCaseAssignedTester_unknownID(self):
330330
buildname='build 4713',
331331
platformname='platform 4714')
332332

333+
def test_unassignTestCaseExecutionTask_unknownID(self):
334+
with self.assertRaisesRegex(TLResponseError, '3000.*4711'):
335+
self.client.unassignTestCaseExecutionTask(4711, 'TC-4712',
336+
buildname='build 4713',
337+
platformname='platform 4714',
338+
user='username',action='unassignOne')
339+
333340

334341
if __name__ == "__main__":
335342
#import sys;sys.argv = ['', 'Test.testName']

0 commit comments

Comments
 (0)