Skip to content

Commit 22d44b5

Browse files
author
Luiko Czub
committed
testlinkapi new private method _emptyStepsList()
1 parent d92afa1 commit 22d44b5

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/testlink/testlinkapi.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, server_url, devKey, **kwargs):
5858
# reportTCResult(None, newTestPlanID, None, 'f', '', guess=True,
5959
# testcaseexternalid=tc_aa_full_ext_id)
6060
# otherwise xmlrpclib raise an error, that None values are not allowed
61-
self.stepsList = []
61+
self._emptyStepsList()
6262
self._changePositionalArgConfig()
6363

6464
def _changePositionalArgConfig(self):
@@ -469,14 +469,8 @@ def initStep(self, actions, expected_results, execution_type):
469469
""" initStep :
470470
Initializes the list which stores the Steps of a Test Case to create
471471
"""
472-
self.stepsList = []
473-
lst = {}
474-
lst['step_number'] = '1'
475-
lst['actions'] = actions
476-
lst['expected_results'] = expected_results
477-
lst['execution_type'] = str(execution_type)
478-
self.stepsList.append(lst)
479-
return True
472+
self._emptyStepsList()
473+
return self.appendStep(actions, expected_results, execution_type)
480474

481475
def appendStep(self, actions, expected_results, execution_type):
482476
""" appendStep :
@@ -488,7 +482,11 @@ def appendStep(self, actions, expected_results, execution_type):
488482
lst['expected_results'] = expected_results
489483
lst['execution_type'] = str(execution_type)
490484
self.stepsList.append(lst)
491-
return True
485+
return True
486+
487+
def _emptyStepsList(self):
488+
""" reset .stepsList to an empty List """
489+
self.stepsList = []
492490

493491
def getProjectIDByName(self, projectName):
494492
projects=self.getProjects()

test/utest-offline/testlinkapi_offline_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ class TestLinkAPIOfflineTestCase(unittest.TestCase):
338338
@classmethod
339339
def setUpClass(cls):
340340
cls.api = TestLinkHelper().connect(DummyAPIClient)
341+
342+
def setUp(self):
343+
self.api._emptyStepsList()
341344

342345
# def tearDown(self):
343346
# pass

0 commit comments

Comments
 (0)