Skip to content

Commit 6e65170

Browse files
author
Luiko Czub
committed
configuration for postional args added lczub#7
1 parent f86d877 commit 6e65170

File tree

6 files changed

+1287
-113
lines changed

6 files changed

+1287
-113
lines changed

example/TestLinkExampleGenericApi.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,10 @@
100100
# "notes=This is a Project created with the API", "active=1", "public=1",
101101
# "options=requirementsEnabled:0,testPriorityEnabled:1,automationEnabled:1,inventoryEnabled:0")
102102
# GENERIC
103-
newProject = myTestLink.createTestProject(
104-
testprojectname=NEWPROJECT, testcaseprefix='GPROAPI',
105-
notes='This is a Project created with the Generic API', active=1, public=1,
106-
requirementsEnabled=0, testPriorityEnabled=1, automationEnabled=1,
107-
inventoryEnabled=0)
103+
newProject = myTestLink.createTestProject(NEWPROJECT, 'GPROAPI',
104+
notes='This is a Project created with the Generic API', active=1, public=1,
105+
options={ 'requirementsEnabled' : 0, 'testPriorityEnabled' : 1,
106+
'automationEnabled' : 1, 'inventoryEnabled' : 0})
108107
print(newProject)
109108
isOk = newProject[0]['message']
110109
if isOk=="Success!":

src/testlink/testlinkapi.py

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
class TestlinkAPIClient(TestlinkAPIGeneric):
2727

28+
__slots__ = ['stepsList']
29+
30+
def __init__(self, server_url, devKey):
31+
super(TestlinkAPIClient, self).__init__(server_url, devKey)
32+
self.stepsList = []
2833

2934
#
3035
# BUILT-IN API CALLS
@@ -49,15 +54,15 @@ class TestlinkAPIClient(TestlinkAPIGeneric):
4954
# return self._callServer('ping')
5055

5156
def echo(self, message):
52-
return self._callServer('repeat', {'str': message})
57+
return self.repeat(message)
5358

54-
def doesUserExist(self, user):
55-
""" doesUserExist :
56-
Checks if a user name exists
57-
"""
58-
argsAPI = {'devKey' : self.devKey,
59-
'user':str(user)}
60-
return self._callServer('doesUserExist', argsAPI)
59+
# def doesUserExist(self, user):
60+
# """ doesUserExist :
61+
# Checks if a user name exists
62+
# """
63+
# argsAPI = {'devKey' : self.devKey,
64+
# 'user':str(user)}
65+
# return self._callServer('doesUserExist', argsAPI)
6166

6267
def getBuildsForTestPlan(self, testplanid):
6368
""" getBuildsForTestPlan :
@@ -258,33 +263,33 @@ def getTotalsForTestPlan(self, testplanid):
258263
'testplanid' : str(testplanid)}
259264
return self._callServer('getTotalsForTestPlan', argsAPI)
260265

261-
def createTestProject(self, *args):
262-
""" createTestProject :
263-
Create a test project
264-
Mandatory parameters : testprojectname, testcaseprefix
265-
Optional parameters : notes, options, active, public
266-
Options: map of requirementsEnabled, testPriorityEnabled,
267-
automationEnabled, inventoryEnabled
268-
"""
269-
testprojectname = args[0]
270-
testcaseprefix = args[1]
271-
options={}
272-
argsAPI = {'devKey' : self.devKey,
273-
'testprojectname' : str(testprojectname),
274-
'testcaseprefix' : str(testcaseprefix)}
275-
if len(args)>2:
276-
params = args[2:]
277-
for param in params:
278-
paramlist = param.split("=")
279-
if paramlist[0] == "options":
280-
optionlist = paramlist[1].split(",")
281-
for option in optionlist:
282-
optiontuple = option.split(":")
283-
options[optiontuple[0]] = optiontuple[1]
284-
argsAPI[paramlist[0]] = options
285-
else:
286-
argsAPI[paramlist[0]] = paramlist[1]
287-
return self._callServer('createTestProject', argsAPI)
266+
# def createTestProject(self, *args):
267+
# """ createTestProject :
268+
# Create a test project
269+
# Mandatory parameters : testprojectname, testcaseprefix
270+
# Optional parameters : notes, options, active, public
271+
# Options: map of requirementsEnabled, testPriorityEnabled,
272+
# automationEnabled, inventoryEnabled
273+
# """
274+
# testprojectname = args[0]
275+
# testcaseprefix = args[1]
276+
# options={}
277+
# argsAPI = {'devKey' : self.devKey,
278+
# 'testprojectname' : str(testprojectname),
279+
# 'testcaseprefix' : str(testcaseprefix)}
280+
# if len(args)>2:
281+
# params = args[2:]
282+
# for param in params:
283+
# paramlist = param.split("=")
284+
# if paramlist[0] == "options":
285+
# optionlist = paramlist[1].split(",")
286+
# for option in optionlist:
287+
# optiontuple = option.split(":")
288+
# options[optiontuple[0]] = optiontuple[1]
289+
# argsAPI[paramlist[0]] = options
290+
# else:
291+
# argsAPI[paramlist[0]] = paramlist[1]
292+
# return self._callServer('createTestProject', argsAPI)
288293

289294
def createBuild(self, testplanid, buildname, buildnotes):
290295
""" createBuild :

0 commit comments

Comments
 (0)