22
33import pytest
44from mcp .server .fastmcp .exceptions import ToolError
5- from gg_api_core .tools .list_honey_tokens import list_honeytokens
5+ from gg_api_core .tools .list_honey_tokens import list_honeytokens , ListHoneytokensParams
66
77
88class TestListHoneytokens :
@@ -36,15 +36,17 @@ async def test_list_honeytokens_success(self, mock_gitguardian_client):
3636
3737 # Call the function
3838 result = await list_honeytokens (
39- status = None ,
40- search = None ,
41- ordering = None ,
42- show_token = False ,
43- creator_id = None ,
44- creator_api_token_id = None ,
45- per_page = 20 ,
46- get_all = False ,
47- mine = False ,
39+ ListHoneytokensParams (
40+ status = None ,
41+ search = None ,
42+ ordering = None ,
43+ show_token = False ,
44+ creator_id = None ,
45+ creator_api_token_id = None ,
46+ per_page = 20 ,
47+ get_all = False ,
48+ mine = False ,
49+ )
4850 )
4951
5052 # Verify client was called with correct parameters
@@ -74,15 +76,17 @@ async def test_list_honeytokens_list_format(self, mock_gitguardian_client):
7476
7577 # Call the function
7678 result = await list_honeytokens (
77- status = None ,
78- search = None ,
79- ordering = None ,
80- show_token = False ,
81- creator_id = None ,
82- creator_api_token_id = None ,
83- per_page = 20 ,
84- get_all = False ,
85- mine = False ,
79+ ListHoneytokensParams (
80+ status = None ,
81+ search = None ,
82+ ordering = None ,
83+ show_token = False ,
84+ creator_id = None ,
85+ creator_api_token_id = None ,
86+ per_page = 20 ,
87+ get_all = False ,
88+ mine = False ,
89+ )
8690 )
8791
8892 # Verify response
@@ -110,15 +114,17 @@ async def test_list_honeytokens_with_filters(self, mock_gitguardian_client):
110114
111115 # Call the function with filters
112116 result = await list_honeytokens (
113- status = "ACTIVE" ,
114- search = "filtered" ,
115- ordering = "-created_at" ,
116- show_token = True ,
117- creator_id = None ,
118- creator_api_token_id = None ,
119- per_page = 50 ,
120- get_all = False ,
121- mine = False ,
117+ ListHoneytokensParams (
118+ status = "ACTIVE" ,
119+ search = "filtered" ,
120+ ordering = "-created_at" ,
121+ show_token = True ,
122+ creator_id = None ,
123+ creator_api_token_id = None ,
124+ per_page = 50 ,
125+ get_all = False ,
126+ mine = False ,
127+ )
122128 )
123129
124130 # Verify client was called with correct parameters
@@ -160,15 +166,17 @@ async def test_list_honeytokens_mine_true(self, mock_gitguardian_client):
160166
161167 # Call the function with mine=True
162168 result = await list_honeytokens (
163- status = None ,
164- search = None ,
165- ordering = None ,
166- show_token = False ,
167- creator_id = None ,
168- creator_api_token_id = None ,
169- per_page = 20 ,
170- get_all = False ,
171- mine = True ,
169+ ListHoneytokensParams (
170+ status = None ,
171+ search = None ,
172+ ordering = None ,
173+ show_token = False ,
174+ creator_id = None ,
175+ creator_api_token_id = None ,
176+ per_page = 20 ,
177+ get_all = False ,
178+ mine = True ,
179+ )
172180 )
173181
174182 # Verify get_current_token_info was called
@@ -202,15 +210,17 @@ async def test_list_honeytokens_mine_true_no_user_id(
202210
203211 # Call the function with mine=True
204212 result = await list_honeytokens (
205- status = None ,
206- search = None ,
207- ordering = None ,
208- show_token = False ,
209- creator_id = None ,
210- creator_api_token_id = None ,
211- per_page = 20 ,
212- get_all = False ,
213- mine = True ,
213+ ListHoneytokensParams (
214+ status = None ,
215+ search = None ,
216+ ordering = None ,
217+ show_token = False ,
218+ creator_id = None ,
219+ creator_api_token_id = None ,
220+ per_page = 20 ,
221+ get_all = False ,
222+ mine = True ,
223+ )
214224 )
215225
216226 # Verify that creator_id was not set (should be None)
@@ -236,15 +246,17 @@ async def test_list_honeytokens_get_all(self, mock_gitguardian_client):
236246
237247 # Call the function with get_all=True
238248 result = await list_honeytokens (
239- status = None ,
240- search = None ,
241- ordering = None ,
242- show_token = False ,
243- creator_id = None ,
244- creator_api_token_id = None ,
245- per_page = 20 ,
246- get_all = True ,
247- mine = False ,
249+ ListHoneytokensParams (
250+ status = None ,
251+ search = None ,
252+ ordering = None ,
253+ show_token = False ,
254+ creator_id = None ,
255+ creator_api_token_id = None ,
256+ per_page = 20 ,
257+ get_all = True ,
258+ mine = False ,
259+ )
248260 )
249261
250262 # Verify client was called with get_all=True
@@ -267,15 +279,17 @@ async def test_list_honeytokens_empty_response(self, mock_gitguardian_client):
267279
268280 # Call the function
269281 result = await list_honeytokens (
270- status = None ,
271- search = None ,
272- ordering = None ,
273- show_token = False ,
274- creator_id = None ,
275- creator_api_token_id = None ,
276- per_page = 20 ,
277- get_all = False ,
278- mine = False ,
282+ ListHoneytokensParams (
283+ status = None ,
284+ search = None ,
285+ ordering = None ,
286+ show_token = False ,
287+ creator_id = None ,
288+ creator_api_token_id = None ,
289+ per_page = 20 ,
290+ get_all = False ,
291+ mine = False ,
292+ )
279293 )
280294
281295 # Verify response is empty
@@ -293,15 +307,17 @@ async def test_list_honeytokens_client_error(self, mock_gitguardian_client):
293307 # Call the function and expect a ToolError
294308 with pytest .raises (ToolError ) as excinfo :
295309 await list_honeytokens (
296- status = None ,
297- search = None ,
298- ordering = None ,
299- show_token = False ,
300- creator_id = None ,
301- creator_api_token_id = None ,
302- per_page = 20 ,
303- get_all = False ,
304- mine = False ,
310+ ListHoneytokensParams (
311+ status = None ,
312+ search = None ,
313+ ordering = None ,
314+ show_token = False ,
315+ creator_id = None ,
316+ creator_api_token_id = None ,
317+ per_page = 20 ,
318+ get_all = False ,
319+ mine = False ,
320+ )
305321 )
306322
307323 # Verify error message
@@ -320,15 +336,17 @@ async def test_list_honeytokens_with_creator_id(self, mock_gitguardian_client):
320336
321337 # Call the function with explicit creator_id
322338 result = await list_honeytokens (
323- status = None ,
324- search = None ,
325- ordering = None ,
326- show_token = False ,
327- creator_id = "specific_user_123" ,
328- creator_api_token_id = None ,
329- per_page = 20 ,
330- get_all = False ,
331- mine = False ,
339+ ListHoneytokensParams (
340+ status = None ,
341+ search = None ,
342+ ordering = None ,
343+ show_token = False ,
344+ creator_id = "specific_user_123" ,
345+ creator_api_token_id = None ,
346+ per_page = 20 ,
347+ get_all = False ,
348+ mine = False ,
349+ )
332350 )
333351
334352 # Verify client was called with correct creator_id
@@ -350,15 +368,17 @@ async def test_list_honeytokens_with_creator_api_token_id(
350368
351369 # Call the function with creator_api_token_id
352370 result = await list_honeytokens (
353- status = None ,
354- search = None ,
355- ordering = None ,
356- show_token = False ,
357- creator_id = None ,
358- creator_api_token_id = "token_123" ,
359- per_page = 20 ,
360- get_all = False ,
361- mine = False ,
371+ ListHoneytokensParams (
372+ status = None ,
373+ search = None ,
374+ ordering = None ,
375+ show_token = False ,
376+ creator_id = None ,
377+ creator_api_token_id = "token_123" ,
378+ per_page = 20 ,
379+ get_all = False ,
380+ mine = False ,
381+ )
362382 )
363383
364384 # Verify client was called with correct creator_api_token_id
@@ -387,15 +407,17 @@ async def test_list_honeytokens_show_token_true(self, mock_gitguardian_client):
387407
388408 # Call the function with show_token=True
389409 result = await list_honeytokens (
390- status = None ,
391- search = None ,
392- ordering = None ,
393- show_token = True ,
394- creator_id = None ,
395- creator_api_token_id = None ,
396- per_page = 20 ,
397- get_all = False ,
398- mine = False ,
410+ ListHoneytokensParams (
411+ status = None ,
412+ search = None ,
413+ ordering = None ,
414+ show_token = True ,
415+ creator_id = None ,
416+ creator_api_token_id = None ,
417+ per_page = 20 ,
418+ get_all = False ,
419+ mine = False ,
420+ )
399421 )
400422
401423 # Verify client was called with show_token=True
@@ -425,15 +447,17 @@ async def test_list_honeytokens_mine_true_token_info_error(
425447
426448 # Call the function with mine=True (should not fail, just log warning)
427449 result = await list_honeytokens (
428- status = None ,
429- search = None ,
430- ordering = None ,
431- show_token = False ,
432- creator_id = None ,
433- creator_api_token_id = None ,
434- per_page = 20 ,
435- get_all = False ,
436- mine = True ,
450+ ListHoneytokensParams (
451+ status = None ,
452+ search = None ,
453+ ordering = None ,
454+ show_token = False ,
455+ creator_id = None ,
456+ creator_api_token_id = None ,
457+ per_page = 20 ,
458+ get_all = False ,
459+ mine = True ,
460+ )
437461 )
438462
439463 # Verify function completes without error
0 commit comments