Skip to content

Commit 2544cc2

Browse files
author
Luiko Czub
committed
new api - getTestSuiteAttachments #83
1 parent 86878cb commit 2544cc2

7 files changed

+43
-2
lines changed

Diff for: CHANGES.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ TestLink-API-Python-client v0.6.5 (under develop)
55
-------------------------------------------------
66
support for TL 1.9.17 future release and py27, py34, py35 and py36
77

8-
implement 1.9.17 new api interfaces - #76, #82
9-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
implement 1.9.17 new api interfaces - #76, #81, #82, #83
9+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1010

1111
- getExecutionSet(<testplanid>, [testcaseid=<testcaseid>], [testcaseexternalid=<testcaseexternalid>],
1212
[buildid=<buildid>], [buildname=<buildname>], [platformid=<platformid>],
1313
[platformname=<platformname>], [options=<options>], [devKey=<devKey>])
1414
- getRequirements(<testprojectid>, [testplanid=<testplanid>], [platformid=<platformid>], [devKey=<devKey>])
1515
- getReqCoverage(<testprojectid>, <requirementdocid>, [devKey=<devKey>])
1616
- setTestCaseTestSuite(<testcaseexternalid>, <testsuiteid>, [devKey=<devKey>])
17+
- getTestSuiteAttachments(<testsuiteid>, [devKey=<devKey>])
1718

1819
known TL 1.9.17-DEV issues:
1920
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Diff for: example/TestLinkExample.py

+4
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@
689689
newAttachment = myTestLink.uploadTestSuiteAttachment(NEWATTACHMENT_PNG, newTestSuiteID_A,
690690
title='PNG Example', description='PNG Attachment Example for a TestSuite')
691691
print("uploadTestSuiteAttachment", newAttachment)
692+
# get Attachment of test suite A
693+
response = myTestLink.getTestSuiteAttachments(newTestSuiteID_A)
694+
print("getTestSuiteAttachments", response)
695+
692696
# add png file as Attachment to test case B
693697
a_file=open(NEWATTACHMENT_PNG, mode='rb')
694698
newAttachment = myTestLink.uploadTestCaseAttachment(a_file, newTestCaseID_B,

Diff for: example/TestLinkExampleGenericApi.py

+4
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,10 @@
695695
newAttachment = myTestLink.uploadTestSuiteAttachment(NEWATTACHMENT_PNG, newTestSuiteID_A,
696696
title='PNG Example', description='PNG Attachment Example for a TestSuite')
697697
print("uploadTestSuiteAttachment", newAttachment)
698+
# get Attachment of test suite A
699+
response = myTestLink.getTestSuiteAttachments(newTestSuiteID_A)
700+
print("getTestSuiteAttachments", response)
701+
698702
# add png file as Attachment to test case B
699703
a_file=open(NEWATTACHMENT_PNG, mode='rb')
700704
newAttachment = myTestLink.uploadTestCaseAttachment(a_file, newTestCaseID_B,

Diff for: src/testlink/testlinkapigeneric.py

+21
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,27 @@ def setTestCaseTestSuite(self):
18881888
testsuiteid - identifies the test suite
18891889
18901890
"""
1891+
1892+
# /**
1893+
# * Gets attachments for specified test suite.
1894+
# * The attachment file content is Base64 encoded. To save the file to disk in client,
1895+
# * Base64 decode the content and write file in binary mode.
1896+
# *
1897+
# * @param struct $args
1898+
# * @param string $args["devKey"] Developer key
1899+
# * @param int $args["testsuiteid"]: id of the testsuite
1900+
# *
1901+
# * @return mixed $resultInfo
1902+
# * @author [email protected]
1903+
# */
1904+
# public function getTestSuiteAttachments($args)
1905+
1906+
@decoApiCallAddDevKey
1907+
@decoMakerApiCallWithArgs(['testsuiteid'], [])
1908+
def getTestSuiteAttachments(self):
1909+
""" Gets attachments for specified test suite.
1910+
The attachment file content is Base64 encoded. To save the file to disk
1911+
in client, Base64 decode the content and write file in binary mode. """
18911912

18921913
#
18931914
# internal methods for general server calls

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

+3
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,9 @@ def test_whatArgs_setTestCaseTestSuite(self):
923923
self.assertIn('<testcaseexternalid>,', argsDescription)
924924
self.assertIn('<testsuiteid>,', argsDescription)
925925

926+
def test_whatArgs_getTestSuiteAttachments(self):
927+
argsDescription = self.api.whatArgs('getTestSuiteAttachments')
928+
self.assertIn('<testsuiteid>,', argsDescription)
926929

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

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

+4
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,10 @@ def test_setTestCaseTestSuite_unknownID(self):
491491
with self.assertRaisesRegex(TLResponseError, '5040.*TC-40000712'):
492492
self.client.setTestCaseTestSuite(
493493
'TC-40000712', '40000713 suite')
494+
495+
def test_getTestSuiteAttachments_unknownID(self):
496+
with self.assertRaisesRegex(TLResponseError, '8000.*40000712'):
497+
self.client.getTestSuiteAttachments(40000712)
494498

495499

496500
if __name__ == "__main__":

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

+4
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ def test_setTestCaseTestSuite_unknownID(self):
478478
self.client.setTestCaseTestSuite(
479479
'TC-40000712', '40000713 suite')
480480

481+
def test_getTestSuiteAttachments_unknownID(self):
482+
with self.assertRaisesRegex(TLResponseError, '8000.*40000712'):
483+
self.client.getTestSuiteAttachments(40000712)
484+
481485

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

0 commit comments

Comments
 (0)