Skip to content

Commit b059fd6

Browse files
committed
chore: add tests
1 parent f5b8c6d commit b059fd6

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

scrapegraph-py/tests/test_crawl_polling.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"""
1010

1111
import json
12+
import time
1213
from unittest.mock import patch
1314
from uuid import uuid4
1415

@@ -58,11 +59,11 @@ def mock_founders_result():
5859
return {
5960
"founders": [
6061
{
61-
"name": "Marco Perini",
62+
"name": "Marco Vinci",
6263
"title": "Co-founder & CEO",
6364
"bio": "AI researcher and entrepreneur",
64-
"linkedin": "https://linkedin.com/in/marco-perini",
65-
"twitter": "https://twitter.com/marco_perini",
65+
"linkedin": "https://linkedin.com/in/marco-vinci",
66+
"twitter": "https://twitter.com/marco_vinci",
6667
},
6768
{
6869
"name": "Lorenzo Padoan",
@@ -441,7 +442,7 @@ def test_crawl_polling_with_timing(
441442

442443
# Simulate the polling loop from crawl_example.py
443444
for i in range(60): # Same as in the example
444-
# time.sleep(5) - mocked out
445+
time.sleep(5) # This will be mocked out
445446
result = client.get_crawl(crawl_id)
446447
if result.get("status") == "success" and result.get("result"):
447448
# Verify successful completion

scrapegraph-py/tests/utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
Utility functions for tests
3+
"""
4+
import uuid
5+
6+
7+
def generate_mock_api_key() -> str:
8+
"""Generate a mock API key for testing purposes"""
9+
# Generate a realistic looking API key format: sgai-{uuid}
10+
mock_uuid = str(uuid.uuid4()).replace('-', '')
11+
return f"sgai-{mock_uuid}"

0 commit comments

Comments
 (0)