@@ -205,18 +205,26 @@ def test_collection(
205
205
206
206
207
207
@pytest .mark .parametrize ("is_public" , [True , False ])
208
+ @pytest .mark .parametrize ("is_public_write" , [True , False ])
208
209
@pytest .mark .parametrize ("method" , ["get" , "post" , "delete" ])
209
210
def test_collection_unauthenticated (
210
211
client ,
211
212
method ,
212
213
is_public ,
214
+ is_public_write ,
213
215
):
214
216
if is_public :
215
217
collection_id = COLLECTIONS [6 ].id
216
218
if method == "get" :
217
219
expected_status_code = 200
218
220
else :
219
221
expected_status_code = 405
222
+ elif is_public_write :
223
+ collection_id = COLLECTIONS [7 ].id
224
+ if method == "get" :
225
+ expected_status_code = 200
226
+ else :
227
+ expected_status_code = 405
220
228
else :
221
229
collection_id = COLLECTIONS [0 ].id
222
230
if method == "get" :
@@ -241,14 +249,15 @@ def test_collection_unauthenticated(
241
249
242
250
243
251
@pytest .mark .parametrize (
244
- ["api_root_id" , "title" , "description" , "alias" , "is_public" ],
252
+ ["api_root_id" , "title" , "description" , "alias" , "is_public" , "is_public_write" ],
245
253
[
246
254
pytest .param (
247
255
API_ROOTS [0 ].id , # api_root_id
248
256
"my new collection" , # title
249
257
None , # description
250
258
None , # alias
251
259
False , # is_public
260
+ False , # is_public_write
252
261
id = "api_root_id, title" ,
253
262
),
254
263
pytest .param (
@@ -257,6 +266,7 @@ def test_collection_unauthenticated(
257
266
"my description" , # description
258
267
None , # alias
259
268
True , # is_public
269
+ False , # is_public_write
260
270
id = "api_root_id, title, description" ,
261
271
),
262
272
pytest .param (
@@ -265,26 +275,29 @@ def test_collection_unauthenticated(
265
275
"my description" , # description
266
276
"my-alias" , # alias
267
277
False , # is_public
278
+ True , # is_public_write
268
279
id = "api_root_id, title, description, alias" ,
269
280
),
270
281
],
271
282
)
272
283
def test_add_collection (
273
- app , api_root_id , title , description , alias , is_public , db_api_roots , db_collections
284
+ app , api_root_id , title , description , alias , is_public , is_public_write , db_api_roots , db_collections
274
285
):
275
286
collection = app .taxii_server .servers .taxii2 .persistence .api .add_collection (
276
287
api_root_id = api_root_id ,
277
288
title = title ,
278
289
description = description ,
279
290
alias = alias ,
280
291
is_public = is_public ,
292
+ is_public_write = is_public_write ,
281
293
)
282
294
assert collection .id is not None
283
295
assert str (collection .api_root_id ) == api_root_id
284
296
assert collection .title == title
285
297
assert collection .description == description
286
298
assert collection .alias == alias
287
299
assert collection .is_public == is_public
300
+ assert collection .is_public_write == is_public_write
288
301
db_collection = (
289
302
app .taxii_server .servers .taxii2 .persistence .api .db .session .query (
290
303
taxii2models .Collection
@@ -297,3 +310,4 @@ def test_add_collection(
297
310
assert db_collection .description == description
298
311
assert db_collection .alias == alias
299
312
assert db_collection .is_public == is_public
313
+ assert db_collection .is_public_write == is_public_write
0 commit comments