Skip to content

Commit ef197e7

Browse files
author
Luiko Czub
committed
changed api - createTestProject - link a project with an ITS #69
includes also new api getIssueTrackerSystem
1 parent 86b6fc1 commit ef197e7

8 files changed

+107
-4
lines changed

Diff for: CHANGES.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ TestLink-API-Python-client v0.6.3 - Under Develop
55
------------------------------------------------------------
66
support for TL 1.9.15 release
77

8-
implement 1.9.15 new api interfaces - #54 #67
8+
implement 1.9.15 new api interfaces - #54 #67 #69
99
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1010

1111
new TestlinkAPIGeneric and TestlinkAPIClient api methods
@@ -14,8 +14,9 @@ new TestlinkAPIGeneric and TestlinkAPIClient api methods
1414
[prefix=<prefix>], [parentid=<parentid>], [testsuitename=<testsuitename>],
1515
[details=<details>], [order=<order>], [devKey=<devKey>])
1616
- getTestSuite(<testsuitename>, <prefix>, [devKey=<devKey>])
17-
18-
implement 1.9.15 changed api interfaces - #68 #70 #72 #71
17+
- getIssueTrackerSystem(<itsname>, [devKey=<devKey>])
18+
19+
implement 1.9.15 changed api interfaces - #68 #70 #72 #71 #69
1920
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021

2122
changed TestlinkAPIGeneric and TestlinkAPIClient api methods
@@ -33,6 +34,8 @@ changed TestlinkAPIGeneric and TestlinkAPIClient api methods
3334
<overwrite> to update linked Test Case Versions
3435
- createTestCase() is adapted to to support the new optional arguments <status>
3536
and <estimatedexecduration>
37+
- createTestProject() is adapted to to support the new optional arguments
38+
<itsname> and <itsenabled> to link a project with an ITS
3639

3740
examples:
3841

Diff for: example/TestLinkExample.py

+6
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112

113113
NEWPROJECT="NEW_PROJECT_API-%s" % myPyVersionShort
114114
NEWPREFIX="NPROAPI%s" % myPyVersionShort
115+
ITSNAME="myITS"
115116

116117
# used connection settings
117118
print(myTestLink.connectionInfo())
@@ -156,12 +157,17 @@
156157
print("deleteTestProject", response)
157158
except TLResponseError:
158159
print("No project with prefix %s exists" % NEWPREFIX)
160+
161+
# # get IssueTrackerSystem
162+
# aITS=myTestLink.getIssueTrackerSystem(aITSNAME)
163+
# print("getIssueTrackerSystem", aITS)
159164

160165
# Creates the project
161166
projInfo = 'Example created with Python %s API class %s in TL %s' % \
162167
( python_version(), myApiVersion, myTLVersion )
163168
newProject = myTestLink.createTestProject(NEWPROJECT, NEWPREFIX,
164169
notes=projInfo, active=1, public=1,
170+
# itsname=ITSNAME, itsenabled=1,
165171
options={'requirementsEnabled' : 0, 'testPriorityEnabled' : 1,
166172
'automationEnabled' : 1, 'inventoryEnabled' : 0})
167173
print("createTestProject", newProject)

Diff for: example/TestLinkExampleGenericApi.py

+6
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101

102102
NEWPROJECT="PROJECT_API_GENERIC-%s" % myPyVersionShort
103103
NEWPREFIX="GPROAPI%s" % myPyVersionShort
104+
ITSNAME="myITS"
104105

105106
# used connection settings
106107
print(myTestLink.connectionInfo())
@@ -146,11 +147,16 @@
146147
except TLResponseError:
147148
print("No project with prefix %s exists" % NEWPREFIX)
148149

150+
# # get IssueTrackerSystem
151+
# aITS=myTestLink.getIssueTrackerSystem(aITSNAME)
152+
# print("getIssueTrackerSystem", aITS)
153+
149154
# Creates the project
150155
projInfo = 'Example created with Python %s API class %s in TL %s' % \
151156
( myPyVersion, myApiVersion, myTLVersion )
152157
newProject = myTestLink.createTestProject(NEWPROJECT, NEWPREFIX,
153158
notes=projInfo, active=1, public=1,
159+
# itsname=ITSNAME, itsenabled=1,
154160
options={'requirementsEnabled' : 1, 'testPriorityEnabled' : 1,
155161
'automationEnabled' : 1, 'inventoryEnabled' : 1})
156162
print("createTestProject", newProject)

Diff for: src/testlink/testlinkapigeneric.py

+41-1
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,32 @@ def getTestSuitesForTestPlan(self):
212212
213213
returns an empty list, if no suite is assigned """
214214

215+
216+
# /**
217+
# * create a test project
218+
# *
219+
# * @param struct $args
220+
# * @param string $args["devKey"]
221+
# * @param string $args["testprojectname"]
222+
# * @param string $args["testcaseprefix"]
223+
# * @param string $args["notes"] OPTIONAL
224+
# * @param map $args["options"] OPTIONAL ALL int treated as boolean
225+
# * keys requirementsEnabled,testPriorityEnabled,automationEnabled,inventoryEnabled
226+
# *
227+
# * @param int $args["active"] OPTIONAL
228+
# * @param int $args["public"] OPTIONAL
229+
# * @param string $args["itsname"] OPTIONAL
230+
# * @param boolean $args["itsEnabled"] OPTIONAL
231+
# *
232+
# *
233+
# * @return mixed $resultInfo
234+
# */
235+
# public function createTestProject($args)
236+
215237
@decoApiCallAddDevKey
216238
@decoMakerApiCallWithArgs(['testprojectname', 'testcaseprefix'],
217-
['notes', 'active', 'public', 'options'])
239+
['notes', 'active', 'public', 'options',
240+
'itsname', 'itsenabled'])
218241
def createTestProject(self):
219242
""" Create a test project
220243
@@ -1673,6 +1696,23 @@ def updateTestSuite(self):
16731696
- details - if defined test suite details will be changed
16741697
- order - if defined, order inside parent container is changed
16751698
"""
1699+
1700+
# /**
1701+
# * Get Issue Tracker System by name
1702+
# *
1703+
# * @param struct $args
1704+
# * @param string $args["devKey"]
1705+
# * @param string $args["itsname"] ITS name
1706+
# * @return mixed $itsObject
1707+
# * @access public
1708+
# */
1709+
# public function getIssueTrackerSystem($args,$call=null)
1710+
1711+
@decoApiCallAddDevKey
1712+
@decoMakerApiCallWithArgs(['itsname'], [])
1713+
def getIssueTrackerSystem(self):
1714+
""" Get Issue Tracker System by name """
1715+
16761716

16771717
#
16781718
# internal methods for general server calls

Diff for: test/utest-offline/testlinkapi_offline_test.py

+15
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,21 @@ def test_whatArgs_addTestCaseToTestPlan(self):
719719
self.assertIn('executionorder=<executionorder>', argsDescription)
720720
self.assertIn('urgency=<urgency>', argsDescription)
721721
self.assertIn('overwrite=<overwrite>', argsDescription)
722+
723+
def test_whatArgs_createTestProject(self):
724+
argsDescription = self.api.whatArgs('createTestProject')
725+
self.assertIn('<testprojectname>,', argsDescription)
726+
self.assertIn('<testcaseprefix>,', argsDescription)
727+
self.assertIn('notes=<notes>', argsDescription)
728+
self.assertIn('active=<active>', argsDescription)
729+
self.assertIn('public=<public>', argsDescription)
730+
self.assertIn('options=<options>', argsDescription)
731+
self.assertIn('itsname=<itsname>', argsDescription)
732+
self.assertIn('itsenabled=<itsenabled>', argsDescription)
733+
734+
def test_whatArgs_getIssueTrackerSystem(self):
735+
argsDescription = self.api.whatArgs('getIssueTrackerSystem')
736+
self.assertIn('<itsname>,', argsDescription)
722737

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

Diff for: test/utest-offline/testlinkapigeneric_offline_test.py

+15
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,21 @@ def test_whatArgs_addTestCaseToTestPlan(self):
827827
self.assertIn('urgency=<urgency>', argsDescription)
828828
self.assertIn('overwrite=<overwrite>', argsDescription)
829829

830+
def test_whatArgs_createTestProject(self):
831+
argsDescription = self.api.whatArgs('createTestProject')
832+
self.assertIn('<testprojectname>,', argsDescription)
833+
self.assertIn('<testcaseprefix>,', argsDescription)
834+
self.assertIn('notes=<notes>', argsDescription)
835+
self.assertIn('active=<active>', argsDescription)
836+
self.assertIn('public=<public>', argsDescription)
837+
self.assertIn('options=<options>', argsDescription)
838+
self.assertIn('itsname=<itsname>', argsDescription)
839+
self.assertIn('itsenabled=<itsenabled>', argsDescription)
840+
841+
def test_whatArgs_getIssueTrackerSystem(self):
842+
argsDescription = self.api.whatArgs('getIssueTrackerSystem')
843+
self.assertIn('<itsname>,', argsDescription)
844+
830845
if __name__ == "__main__":
831846
#import sys;sys.argv = ['', 'Test.testName']
832847
unittest.main()

Diff for: test/utest-online/testlinkapi_generic_online_test.py

+9
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ def test_createTestProject_unknownID(self):
9494
self.client.createTestProject(testprojectname='',
9595
testcaseprefix='P40000711')
9696

97+
def test_createTestProject_unknownITS(self):
98+
with self.assertRaisesRegex(TLResponseError, '13000.*Unable to find'):
99+
self.client.createTestProject(testprojectname='aProject',
100+
testcaseprefix='aPrefix', itsname='unknownITS')
101+
97102
def test_getProjects(self):
98103
response = self.client.getProjects()
99104
self.assertIsNotNone(response)
@@ -453,6 +458,10 @@ def test_updateTestSuite_unknownID(self):
453458
details = 'detail 40000713 updated',
454459
order =1)
455460

461+
def test_getIssueTrackerSystem_unknownITS(self):
462+
with self.assertRaisesRegex(TLResponseError, '13000.*Unable to find'):
463+
self.client.getIssueTrackerSystem('unknownITS')
464+
456465

457466

458467
if __name__ == "__main__":

Diff for: test/utest-online/testlinkapi_online_test.py

+9
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ def test_createTestProject_unknownID(self):
178178
with self.assertRaisesRegex(TLResponseError, '7001.*Empty name'):
179179
self.client.createTestProject('', 'P40000711')
180180

181+
def test_createTestProject_unknownITS(self):
182+
with self.assertRaisesRegex(TLResponseError, '13000.*Unable to find'):
183+
self.client.createTestProject(testprojectname='aProject',
184+
testcaseprefix='aPrefix', itsname='unknownITS')
185+
181186
def test_createBuild_unknownID(self):
182187
with self.assertRaisesRegex(TLResponseError, '3000.*40000711'):
183188
self.client.createBuild(40000711, 'Build 40000712', 'note 40000713')
@@ -438,6 +443,10 @@ def test_updateTestSuite_unknownID(self):
438443
testsuitename = 'suite 40000712 updated',
439444
details = 'detail 40000713 updated',
440445
order =1)
446+
447+
def test_getIssueTrackerSystem_unknownITS(self):
448+
with self.assertRaisesRegex(TLResponseError, '13000.*Unable to find'):
449+
self.client.getIssueTrackerSystem('unknownITS')
441450

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

0 commit comments

Comments
 (0)