lczub / TestLink-API-Python-client

A Python client to use the TestLink API
104 stars 63 forks source link

listKeywordsForTC throws KeyError #77

Closed ghost closed 7 years ago

ghost commented 7 years ago

TestLink: 1.9.13 TestLink-API-Python-client: 0.6.3

Comments in code indicate that:

getTestCaseKeywords returns a dictionary like

    #   {'12622': {'34': 'KeyWord01', '36': 'KeyWord03'}}

But in practice, that does not seem to be the case: In [32]: tlc = testlink.TestlinkAPIClient(, )

In [33]: tlc.getTestCaseKeywords(testcaseexternalid='SMF-288') Out[33]: {'42': 'KeywordTest1', '43': 'KeywordTest2', '44': 'KeywordTest3'}

In [34]: tlc.getTestCaseKeywords(testcaseexternalid='SMF-309') Out[34]: {'42': 'KeywordTest1'}

In [35]: tlc.listKeywordsForTC('SMF-309')

KeyError Traceback (most recent call last)

in () ----> 1 tlc.listKeywordsForTC('SMF-309') /home/dhaak/.virtualenvs/garg27/local/lib/python2.7/site-packages/testlink/testlinkapi.pyc in listKeywordsForTC(self, internal_or_external_tc_id) 341 # key is the testcaseid, why that? cause it is possible to ask for 342 # a set of test cases. we are just interested in one tc --> 343 a_keyword_dic = self.getTestCaseKeywords(testcaseid=a_tc_id )[a_tc_id] 344 keywords = a_keyword_dic.values() 345 KeyError: 414419 In [36]: tlc.listKeywordsForTC('SMF-288') --------------------------------------------------------------------------- KeyError Traceback (most recent call last) in () ----> 1 tlc.listKeywordsForTC('SMF-288') /home/dhaak/.virtualenvs/garg27/local/lib/python2.7/site-packages/testlink/testlinkapi.pyc in listKeywordsForTC(self, internal_or_external_tc_id) 341 # key is the testcaseid, why that? cause it is possible to ask for 342 # a set of test cases. we are just interested in one tc --> 343 a_keyword_dic = self.getTestCaseKeywords(testcaseid=a_tc_id )[a_tc_id] 344 keywords = a_keyword_dic.values() 345 KeyError: 412640
lczub commented 7 years ago

Hello parraline,

thanks for the hint. I will try to check this at the end of this week

Regards Luiko

lczub commented 7 years ago

Hello parraline,

I found the reason for your problem. The TestLink server changed the response type of getTestCaseKeywords from 1.9.13 to 1.9.14 and the client was adapted with 0.6.2

Your TestLink server version is 1.9.13, so you have to use the TestLink-API-Python-client 0.6.1 for compatible keyword handling or update your server to 1.9.14 / 1.9.15.

With TestLink Server 1.9.15 and TestLink-API-Python-client 0.6.3 the response looks like:

>>> myTestLink.listKeywordsForTC('NPROAPI34-1')
['KeyWord02']
>>> myTestLink.getTestCaseKeywords(testcaseexternalid='NPROAPI34-1')
{'NPROAPI34-1': {'38': 'KeyWord02'}}

Hope this helps a little bit.

Regards Luiko

lczub commented 7 years ago

No further user comments