Phase 1C: Frontend unified contact UI
This commit is contained in:
+13
-13
@@ -66,13 +66,13 @@ async def test_link_file_to_company(authed_client: AsyncClient):
|
||||
|
||||
resp = await client.post(
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": company_id},
|
||||
json={"entity_type": "contact", "entity_id": company_id},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["file_id"] == file_id
|
||||
assert data["entity_type"] == "company"
|
||||
assert data["entity_type"] == "contact"
|
||||
assert data["entity_id"] == company_id
|
||||
assert data["already_linked"] is False
|
||||
|
||||
@@ -106,7 +106,7 @@ async def test_unlink_file_from_entity(authed_client: AsyncClient):
|
||||
# Link first
|
||||
resp = await client.post(
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": company_id},
|
||||
json={"entity_type": "contact", "entity_id": company_id},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
@@ -115,7 +115,7 @@ async def test_unlink_file_from_entity(authed_client: AsyncClient):
|
||||
resp = await client.request(
|
||||
"DELETE",
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": company_id},
|
||||
json={"entity_type": "contact", "entity_id": company_id},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 204
|
||||
@@ -137,7 +137,7 @@ async def test_list_file_links(authed_client: AsyncClient):
|
||||
# Link to company
|
||||
await client.post(
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": company_id},
|
||||
json={"entity_type": "contact", "entity_id": company_id},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
# Link to contact
|
||||
@@ -164,7 +164,7 @@ async def test_multi_links_one_file_many_entities(authed_client: AsyncClient):
|
||||
entity_id = str(uuid.uuid4())
|
||||
resp = await client.post(
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": entity_id},
|
||||
json={"entity_type": "contact", "entity_id": entity_id},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
@@ -228,7 +228,7 @@ async def test_event_cleanup_on_company_deleted(authed_client: AsyncClient):
|
||||
file_id = str(uuid.uuid4())
|
||||
resp = await client.post(
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": str(company_id)},
|
||||
json={"entity_type": "contact", "entity_id": str(company_id)},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
@@ -309,7 +309,7 @@ async def test_link_invalid_file_id(authed_client: AsyncClient):
|
||||
client, seed = authed_client
|
||||
resp = await client.post(
|
||||
"/api/v1/dms/files/bad-uuid/link",
|
||||
json={"entity_type": "company", "entity_id": str(uuid.uuid4())},
|
||||
json={"entity_type": "contact", "entity_id": str(uuid.uuid4())},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
@@ -321,7 +321,7 @@ async def test_link_invalid_entity_id(authed_client: AsyncClient):
|
||||
client, seed = authed_client
|
||||
resp = await client.post(
|
||||
f"/api/v1/dms/files/{uuid.uuid4()}/link",
|
||||
json={"entity_type": "company", "entity_id": "bad-uuid"},
|
||||
json={"entity_type": "contact", "entity_id": "bad-uuid"},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
@@ -347,14 +347,14 @@ async def test_link_already_linked(authed_client: AsyncClient):
|
||||
company_id = str(seed["company_a"].id)
|
||||
resp = await client.post(
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": company_id},
|
||||
json={"entity_type": "contact", "entity_id": company_id},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["already_linked"] is False
|
||||
resp = await client.post(
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": company_id},
|
||||
json={"entity_type": "contact", "entity_id": company_id},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
@@ -370,7 +370,7 @@ async def test_unlink_not_found(authed_client: AsyncClient):
|
||||
resp = await client.request(
|
||||
"DELETE",
|
||||
f"/api/v1/dms/files/{file_id}/link",
|
||||
json={"entity_type": "company", "entity_id": company_id},
|
||||
json={"entity_type": "contact", "entity_id": company_id},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 404
|
||||
@@ -383,7 +383,7 @@ async def test_unlink_invalid_file_id(authed_client: AsyncClient):
|
||||
resp = await client.request(
|
||||
"DELETE",
|
||||
"/api/v1/dms/files/bad-uuid/link",
|
||||
json={"entity_type": "company", "entity_id": str(uuid.uuid4())},
|
||||
json={"entity_type": "contact", "entity_id": str(uuid.uuid4())},
|
||||
headers=ORIGIN_HEADER,
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
|
||||
Reference in New Issue
Block a user