@@ -70,17 +70,6 @@ def test_client_dns():
70
70
# Simple API tests ################################################
71
71
72
72
73
- def test_currentFiles ():
74
- """360 view Current Files list"""
75
- response = requests .get (SERVER_URL + "/api/listCurrentFiles" )
76
- assert response .status_code == 200
77
-
78
-
79
- def test_statistics ():
80
- """360 view Statistics"""
81
- response = requests .get (SERVER_URL + "/api/statistics" )
82
- assert response .status_code == 200
83
-
84
73
85
74
def test_usertest ():
86
75
"""Verify liveness test works"""
@@ -181,6 +170,38 @@ def test_admingetusers(state: State):
181
170
userlist = response .json ()
182
171
assert len (userlist ) > 1
183
172
173
+ # Endpoints not implemented yet
174
+
175
+ # def test_check_usernames(state: State):
176
+ # """Verify logged-in base_admin can test usernames, gets correct result - existing user """
177
+ # # Build auth string value including token from state
178
+ # b_string = 'Bearer ' + state.state['base_admin']
179
+
180
+ # assert len(b_string) > 24
181
+
182
+ # auth_hdr = {'Authorization' : b_string}
183
+
184
+ # data = {"username":"base_admin"}
185
+ # response = requests.post(SERVER_URL + "/api/admin/user/check_name", headers=auth_hdr, json=data)
186
+ # assert response.status_code == 200
187
+
188
+ # is_user = response.json()
189
+ # assert is_user == 1
190
+
191
+ # def test_check_badusernames(state: State):
192
+ # """Verify logged-in base_admin can test usernames, gets correct result - nonexistant user """
193
+ # # Build auth string value including token from state
194
+ # b_string = 'Bearer ' + state.state['base_admin']
195
+ # assert len(b_string) > 24
196
+ # auth_hdr = {'Authorization' : b_string}
197
+
198
+ # data = {"username":"got_no_username_like_this"}
199
+ # response = requests.post(SERVER_URL + "/api/admin/user/check_name", headers=auth_hdr, json=data)
200
+ # assert response.status_code == 200
201
+
202
+ # is_user = response.json()
203
+ # assert is_user == 0
204
+
184
205
185
206
def test_usergetusers (state : State ):
186
207
"""Verify logged-in base_user *cannot* use JWT to get user list """
@@ -192,3 +213,25 @@ def test_usergetusers(state: State):
192
213
auth_hdr = {'Authorization' : b_string }
193
214
response = requests .get (SERVER_URL + "/api/admin/user/get_users" , headers = auth_hdr )
194
215
assert response .status_code == 403
216
+
217
+
218
+ def test_currentFiles (state : State ):
219
+ """360 view Current Files list"""
220
+
221
+ b_string = 'Bearer ' + state .state ['base_admin' ]
222
+ assert len (b_string ) > 24
223
+ auth_hdr = {'Authorization' : b_string }
224
+
225
+ response = requests .get (SERVER_URL + "/api/listCurrentFiles" , headers = auth_hdr )
226
+ assert response .status_code == 200
227
+
228
+
229
+ def test_statistics (state : State ):
230
+ """360 view Statistics"""
231
+
232
+ b_string = 'Bearer ' + state .state ['base_admin' ]
233
+ assert len (b_string ) > 24
234
+ auth_hdr = {'Authorization' : b_string }
235
+
236
+ response = requests .get (SERVER_URL + "/api/statistics" , headers = auth_hdr )
237
+ assert response .status_code == 200
0 commit comments