feat: add ticket solution closure loop
This commit is contained in:
@@ -39,3 +39,30 @@ def test_link_solution_to_ticket_increments_usage(admin_client, db):
|
||||
assert response.status_code == 200
|
||||
assert response.json()["link_type"] == "adopted"
|
||||
assert response.json()["solution_usage_count"] == 1
|
||||
|
||||
|
||||
def test_list_ticket_solutions_returns_linked_solution_details(admin_client, db):
|
||||
ticket = Ticket.objects.create(ticket_no="TK202607020001", title="A", description="A")
|
||||
solution = admin_client.post(
|
||||
"/api/solutions",
|
||||
data={
|
||||
"title": "Restart callback worker",
|
||||
"problem_signature": "Callback timeout",
|
||||
"root_cause": "Worker queue blocked",
|
||||
"solution": "Restart worker and verify queue depth.",
|
||||
"status": "published",
|
||||
},
|
||||
content_type="application/json",
|
||||
).json()
|
||||
admin_client.post(
|
||||
f"/api/solutions/{solution['id']}/link-ticket",
|
||||
data={"ticket_id": ticket.id, "link_type": "adopted"},
|
||||
content_type="application/json",
|
||||
)
|
||||
|
||||
response = admin_client.get(f"/api/solutions/tickets/{ticket.id}")
|
||||
|
||||
assert response.status_code == 200
|
||||
payload = response.json()
|
||||
assert payload[0]["link_type"] == "adopted"
|
||||
assert payload[0]["solution"]["title"] == "Restart callback worker"
|
||||
|
||||
Reference in New Issue
Block a user