Skip to content

Commit c6b38b8

Browse files
committed
Add tests
1 parent 9cb3cca commit c6b38b8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

backend/test/test_collections.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,33 @@ def test_get_public_collection_slug_redirect(admin_auth_headers, default_org_id)
17621762
assert r.status_code == 404
17631763

17641764

1765+
def test_create_collection_with_failed_crawl(
1766+
admin_auth_headers, default_org_id, canceled_crawl_id
1767+
):
1768+
r = requests.post(
1769+
f"{API_PREFIX}/orgs/{default_org_id}/collections",
1770+
headers=admin_auth_headers,
1771+
json={
1772+
"crawlIds": [canceled_crawl_id],
1773+
"name": "Should get rejected",
1774+
},
1775+
)
1776+
assert r.status_code == 400
1777+
assert r.json()["detail"] == "invalid_failed_crawl"
1778+
1779+
1780+
def test_add_failed_crawl_to_collection(
1781+
admin_auth_headers, default_org_id, canceled_crawl_id
1782+
):
1783+
r = requests.post(
1784+
f"{API_PREFIX}/orgs/{default_org_id}/collections/{_second_coll_id}/add",
1785+
json={"crawlIds": [canceled_crawl_id]},
1786+
headers=admin_auth_headers,
1787+
)
1788+
assert r.status_code == 400
1789+
assert r.json()["detail"] == "invalid_failed_crawl"
1790+
1791+
17651792
def test_delete_collection(crawler_auth_headers, default_org_id, crawler_crawl_id):
17661793
# Delete second collection
17671794
r = requests.delete(

0 commit comments

Comments
 (0)