1717# to cover all possible responses or argument combinations
1818
1919import unittest
20- from testlink import TestLinkAPIClient , TestLinkHelper
20+ from testlink import TestlinkAPIClient , TestLinkHelper
2121
2222
2323class TestLinkAPIOnlineTestCase (unittest .TestCase ):
24- """ TestCases for TestLinkAPIClient - interacts with a TestLink Server.
24+ """ TestCases for TestlinkAPIClient - interacts with a TestLink Server.
2525 works with the example project NEW_PROJECT_API (see TestLinkExample.py)
2626 """
2727
2828 def setUp (self ):
29- self .client = TestLinkHelper ().connect (TestLinkAPIClient )
29+ self .client = TestLinkHelper ().connect (TestlinkAPIClient )
3030
3131
3232# def tearDown(self):
@@ -52,26 +52,32 @@ def test_echo(self):
5252 def test_doesUserExist_unknownID (self ):
5353 response = self .client .doesUserExist ('Big Bird' )
5454 self .assertIn ('Big Bird' , response [0 ]['message' ])
55+ self .assertEqual (10000 , response [0 ]['code' ])
5556
5657 def test_getBuildsForTestPlan_unknownID (self ):
5758 response = self .client .getBuildsForTestPlan (4711 )
5859 self .assertIn ('4711' , response [0 ]['message' ])
60+ self .assertEqual (3000 , response [0 ]['code' ])
5961
6062 def test_getFirstLevelTestSuitesForTestProject_unknownID (self ):
6163 response = self .client .getFirstLevelTestSuitesForTestProject (4711 )
6264 self .assertIn ('4711' , response [0 ]['message' ])
65+ self .assertEqual (7000 , response [0 ]['code' ])
6366
6467 def test_getFullPath_unknownID (self ):
6568 response = self .client .getFullPath (4711 )
6669 self .assertIn ('getFullPath' , response [0 ]['message' ])
70+ self .assertEqual (234 , response [0 ]['code' ])
6771
6872 def test_getLastExecutionResult_unknownID (self ):
6973 response = self .client .getLastExecutionResult (4711 , 4712 )
7074 self .assertIn ('4711' , response [0 ]['message' ])
75+ self .assertEqual (3000 , response [0 ]['code' ])
7176
7277 def test_getLatestBuildForTestPlan_unknownID (self ):
7378 response = self .client .getLatestBuildForTestPlan (4711 )
7479 self .assertIn ('4711' , response [0 ]['message' ])
80+ self .assertEqual (3000 , response [0 ]['code' ])
7581
7682 def test_getProjects (self ):
7783 response = self .client .getProjects ()
@@ -80,85 +86,111 @@ def test_getProjects(self):
8086 def test_getProjectTestPlans_unknownID (self ):
8187 response = self .client .getProjectTestPlans (4711 )
8288 self .assertIn ('4711' , response [0 ]['message' ])
89+ self .assertEqual (7000 , response [0 ]['code' ])
8390
8491 def test_getTestCase_unknownID (self ):
8592 response = self .client .getTestCase (4711 )
86- self .assertIn ('4711' , response [0 ]['message' ])
93+ # FAILURE in 1.9.3 API message: replacement does not work
94+ # The Test Case ID (testcaseid: %s) provided does not exist!
95+ #self.assertIn('4711', response[0]['message'])
96+ self .assertEqual (5000 , response [0 ]['code' ])
8797
8898 def test_getTestCaseAttachments_unknownID (self ):
8999 response = self .client .getTestCaseAttachments (4711 )
90- self .assertIn ('4711' , response [0 ]['message' ])
100+ # FAILURE in 1.9.3 API message: replacement does not work
101+ # The Test Case ID (testcaseid: %s) provided does not exist!
102+ #self.assertIn('4711', response[0]['message'])
103+ self .assertEqual (5000 , response [0 ]['code' ])
91104
92105 def test_getTestCaseCustomFieldDesignValue_unknownID (self ):
93106 response = self .client .getTestCaseCustomFieldDesignValue (
94107 4712 , 1 , 4711 , 'a_field' , 'a_detail' )
95108 self .assertIn ('4711' , response [0 ]['message' ])
109+ self .assertEqual (7000 , response [0 ]['code' ])
96110
97111 def test_getTestCaseIDByName_unknownID (self ):
98112 response = self .client .getTestCaseIDByName ('Big Bird' )
99113 self .assertIn ('getTestCaseIDByName' , response [0 ]['message' ])
114+ self .assertEqual (5030 , response [0 ]['code' ])
100115
101116 def test_getTestCasesForTestPlan_unknownID (self ):
102117 response = self .client .getTestCasesForTestPlan (4711 )
103118 self .assertIn ('4711' , response [0 ]['message' ])
119+ self .assertEqual (3000 , response [0 ]['code' ])
104120
105121 def test_getTestCasesForTestSuite_unknownID (self ):
106122 response = self .client .getTestCasesForTestSuite (4711 , 2 , 'a_detail' )
107123 self .assertIn ('4711' , response [0 ]['message' ])
124+ self .assertEqual (8000 , response [0 ]['code' ])
108125
109126 def test_getTestPlanByName_unknownID (self ):
110127 response = self .client .getTestPlanByName ('project 4711' , 'plan 4712' )
111128 self .assertIn ('4711' , response [0 ]['message' ])
129+ self .assertEqual (7011 , response [0 ]['code' ])
112130
113131 def test_getTestPlanPlatforms_unknownID (self ):
114132 response = self .client .getTestPlanPlatforms (4711 )
115133 self .assertIn ('4711' , response [0 ]['message' ])
134+ self .assertEqual (3000 , response [0 ]['code' ])
116135
117136 def test_getTestProjectByName_unknownID (self ):
118137 response = self .client .getTestProjectByName ('project 4711' )
119138 self .assertIn ('4711' , response [0 ]['message' ])
139+ self .assertEqual (7011 , response [0 ]['code' ])
120140
121141 def test_getTestSuiteByID_unknownID (self ):
122142 response = self .client .getTestSuiteByID (4711 )
123143 self .assertIn ('4711' , response [0 ]['message' ])
144+ self .assertEqual (8000 , response [0 ]['code' ])
124145
125146 def test_getTestSuitesForTestPlan_unknownID (self ):
126147 response = self .client .getTestSuitesForTestPlan (4711 )
127148 self .assertIn ('4711' , response [0 ]['message' ])
149+ self .assertEqual (3000 , response [0 ]['code' ])
128150
129151 def test_getTestSuitesForTestSuite_unknownID (self ):
130152 response = self .client .getTestSuitesForTestSuite (4711 )
131153 self .assertIn ('4711' , response [0 ]['message' ])
154+ self .assertEqual (8000 , response [0 ]['code' ])
132155
133156 def test_getTotalsForTestPlan_unknownID (self ):
134157 response = self .client .getTotalsForTestPlan (4711 )
135158 self .assertIn ('4711' , response [0 ]['message' ])
159+ self .assertEqual (3000 , response [0 ]['code' ])
136160
137161 def test_createTestProject_unknownID (self ):
138162 response = self .client .createTestProject ('' , 'P4711' )
139163 self .assertIn ('Empty name' , response [0 ]['message' ])
164+ self .assertEqual (7001 , response [0 ]['code' ])
140165
141166 def test_createBuild_unknownID (self ):
142167 response = self .client .createBuild (4711 , 'Build 4712' , 'note 4713' )
143168 self .assertIn ('4711' , response [0 ]['message' ])
169+ self .assertEqual (3000 , response [0 ]['code' ])
144170
145171 def test_createTestPlan_unknownID (self ):
146172 response = self .client .createTestPlan ('plan 4711' , 'project 4712' )
147173 self .assertIn ('4712' , response [0 ]['message' ])
174+ self .assertEqual (7011 , response [0 ]['code' ])
148175
149176 def test_createTestSuite_unknownID (self ):
150177 response = self .client .createTestSuite ( 4711 , 'suite 4712' , 'detail 4713' )
151178 self .assertIn ('4711' , response [0 ]['message' ])
179+ self .assertEqual (7000 , response [0 ]['code' ])
152180
153181 def test_createTestCase_unknownID (self ):
154182 response = self .client .createTestCase ('case 4711' , 4712 , 4713 ,
155183 'Big Bird' , 'summary 4714' )
156184 self .assertIn ('4713' , response [0 ]['message' ])
185+ self .assertEqual (7000 , response [0 ]['code' ])
157186
158187 def test_reportTCResult_unknownID (self ):
159188 response = self .client .reportTCResult (4711 , 4712 , 'build 4713' , 'p' ,
160189 'note 4714' )
161- self .assertIn ('4711' , response [0 ]['message' ])
190+ # FAILURE in 1.9.3 API message: replacement does not work
191+ # The Test Case ID (testcaseid: %s) provided does not exist!
192+ #self.assertIn('4711', response[0]['message'])
193+ self .assertEqual (5000 , response [0 ]['code' ])
162194
163195# def test_uploadExecutionAttachment_unknownID(self):
164196# response = self.client.uploadExecutionAttachment('file 4711', 4712,
0 commit comments