17
17
# to cover all possible responses or argument combinations
18
18
19
19
import unittest
20
- from testlink import TestLinkAPIClient , TestLinkHelper
20
+ from testlink import TestlinkAPIClient , TestLinkHelper
21
21
22
22
23
23
class TestLinkAPIOnlineTestCase (unittest .TestCase ):
24
- """ TestCases for TestLinkAPIClient - interacts with a TestLink Server.
24
+ """ TestCases for TestlinkAPIClient - interacts with a TestLink Server.
25
25
works with the example project NEW_PROJECT_API (see TestLinkExample.py)
26
26
"""
27
27
28
28
def setUp (self ):
29
- self .client = TestLinkHelper ().connect (TestLinkAPIClient )
29
+ self .client = TestLinkHelper ().connect (TestlinkAPIClient )
30
30
31
31
32
32
# def tearDown(self):
@@ -52,26 +52,32 @@ def test_echo(self):
52
52
def test_doesUserExist_unknownID (self ):
53
53
response = self .client .doesUserExist ('Big Bird' )
54
54
self .assertIn ('Big Bird' , response [0 ]['message' ])
55
+ self .assertEqual (10000 , response [0 ]['code' ])
55
56
56
57
def test_getBuildsForTestPlan_unknownID (self ):
57
58
response = self .client .getBuildsForTestPlan (4711 )
58
59
self .assertIn ('4711' , response [0 ]['message' ])
60
+ self .assertEqual (3000 , response [0 ]['code' ])
59
61
60
62
def test_getFirstLevelTestSuitesForTestProject_unknownID (self ):
61
63
response = self .client .getFirstLevelTestSuitesForTestProject (4711 )
62
64
self .assertIn ('4711' , response [0 ]['message' ])
65
+ self .assertEqual (7000 , response [0 ]['code' ])
63
66
64
67
def test_getFullPath_unknownID (self ):
65
68
response = self .client .getFullPath (4711 )
66
69
self .assertIn ('getFullPath' , response [0 ]['message' ])
70
+ self .assertEqual (234 , response [0 ]['code' ])
67
71
68
72
def test_getLastExecutionResult_unknownID (self ):
69
73
response = self .client .getLastExecutionResult (4711 , 4712 )
70
74
self .assertIn ('4711' , response [0 ]['message' ])
75
+ self .assertEqual (3000 , response [0 ]['code' ])
71
76
72
77
def test_getLatestBuildForTestPlan_unknownID (self ):
73
78
response = self .client .getLatestBuildForTestPlan (4711 )
74
79
self .assertIn ('4711' , response [0 ]['message' ])
80
+ self .assertEqual (3000 , response [0 ]['code' ])
75
81
76
82
def test_getProjects (self ):
77
83
response = self .client .getProjects ()
@@ -80,85 +86,111 @@ def test_getProjects(self):
80
86
def test_getProjectTestPlans_unknownID (self ):
81
87
response = self .client .getProjectTestPlans (4711 )
82
88
self .assertIn ('4711' , response [0 ]['message' ])
89
+ self .assertEqual (7000 , response [0 ]['code' ])
83
90
84
91
def test_getTestCase_unknownID (self ):
85
92
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' ])
87
97
88
98
def test_getTestCaseAttachments_unknownID (self ):
89
99
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' ])
91
104
92
105
def test_getTestCaseCustomFieldDesignValue_unknownID (self ):
93
106
response = self .client .getTestCaseCustomFieldDesignValue (
94
107
4712 , 1 , 4711 , 'a_field' , 'a_detail' )
95
108
self .assertIn ('4711' , response [0 ]['message' ])
109
+ self .assertEqual (7000 , response [0 ]['code' ])
96
110
97
111
def test_getTestCaseIDByName_unknownID (self ):
98
112
response = self .client .getTestCaseIDByName ('Big Bird' )
99
113
self .assertIn ('getTestCaseIDByName' , response [0 ]['message' ])
114
+ self .assertEqual (5030 , response [0 ]['code' ])
100
115
101
116
def test_getTestCasesForTestPlan_unknownID (self ):
102
117
response = self .client .getTestCasesForTestPlan (4711 )
103
118
self .assertIn ('4711' , response [0 ]['message' ])
119
+ self .assertEqual (3000 , response [0 ]['code' ])
104
120
105
121
def test_getTestCasesForTestSuite_unknownID (self ):
106
122
response = self .client .getTestCasesForTestSuite (4711 , 2 , 'a_detail' )
107
123
self .assertIn ('4711' , response [0 ]['message' ])
124
+ self .assertEqual (8000 , response [0 ]['code' ])
108
125
109
126
def test_getTestPlanByName_unknownID (self ):
110
127
response = self .client .getTestPlanByName ('project 4711' , 'plan 4712' )
111
128
self .assertIn ('4711' , response [0 ]['message' ])
129
+ self .assertEqual (7011 , response [0 ]['code' ])
112
130
113
131
def test_getTestPlanPlatforms_unknownID (self ):
114
132
response = self .client .getTestPlanPlatforms (4711 )
115
133
self .assertIn ('4711' , response [0 ]['message' ])
134
+ self .assertEqual (3000 , response [0 ]['code' ])
116
135
117
136
def test_getTestProjectByName_unknownID (self ):
118
137
response = self .client .getTestProjectByName ('project 4711' )
119
138
self .assertIn ('4711' , response [0 ]['message' ])
139
+ self .assertEqual (7011 , response [0 ]['code' ])
120
140
121
141
def test_getTestSuiteByID_unknownID (self ):
122
142
response = self .client .getTestSuiteByID (4711 )
123
143
self .assertIn ('4711' , response [0 ]['message' ])
144
+ self .assertEqual (8000 , response [0 ]['code' ])
124
145
125
146
def test_getTestSuitesForTestPlan_unknownID (self ):
126
147
response = self .client .getTestSuitesForTestPlan (4711 )
127
148
self .assertIn ('4711' , response [0 ]['message' ])
149
+ self .assertEqual (3000 , response [0 ]['code' ])
128
150
129
151
def test_getTestSuitesForTestSuite_unknownID (self ):
130
152
response = self .client .getTestSuitesForTestSuite (4711 )
131
153
self .assertIn ('4711' , response [0 ]['message' ])
154
+ self .assertEqual (8000 , response [0 ]['code' ])
132
155
133
156
def test_getTotalsForTestPlan_unknownID (self ):
134
157
response = self .client .getTotalsForTestPlan (4711 )
135
158
self .assertIn ('4711' , response [0 ]['message' ])
159
+ self .assertEqual (3000 , response [0 ]['code' ])
136
160
137
161
def test_createTestProject_unknownID (self ):
138
162
response = self .client .createTestProject ('' , 'P4711' )
139
163
self .assertIn ('Empty name' , response [0 ]['message' ])
164
+ self .assertEqual (7001 , response [0 ]['code' ])
140
165
141
166
def test_createBuild_unknownID (self ):
142
167
response = self .client .createBuild (4711 , 'Build 4712' , 'note 4713' )
143
168
self .assertIn ('4711' , response [0 ]['message' ])
169
+ self .assertEqual (3000 , response [0 ]['code' ])
144
170
145
171
def test_createTestPlan_unknownID (self ):
146
172
response = self .client .createTestPlan ('plan 4711' , 'project 4712' )
147
173
self .assertIn ('4712' , response [0 ]['message' ])
174
+ self .assertEqual (7011 , response [0 ]['code' ])
148
175
149
176
def test_createTestSuite_unknownID (self ):
150
177
response = self .client .createTestSuite ( 4711 , 'suite 4712' , 'detail 4713' )
151
178
self .assertIn ('4711' , response [0 ]['message' ])
179
+ self .assertEqual (7000 , response [0 ]['code' ])
152
180
153
181
def test_createTestCase_unknownID (self ):
154
182
response = self .client .createTestCase ('case 4711' , 4712 , 4713 ,
155
183
'Big Bird' , 'summary 4714' )
156
184
self .assertIn ('4713' , response [0 ]['message' ])
185
+ self .assertEqual (7000 , response [0 ]['code' ])
157
186
158
187
def test_reportTCResult_unknownID (self ):
159
188
response = self .client .reportTCResult (4711 , 4712 , 'build 4713' , 'p' ,
160
189
'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' ])
162
194
163
195
# def test_uploadExecutionAttachment_unknownID(self):
164
196
# response = self.client.uploadExecutionAttachment('file 4711', 4712,
0 commit comments