Skip to content

Commit

Permalink
workflows: fix creating ticket entry
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Dec 19, 2024
1 parent 4342f1e commit a6f8655
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def create_ticket_entry(
"ticket_id": ticket_id,
"workflow": workflow_id,
}
return self.run_with_advanced_retry(
_retry_args=self.tenacity_retry_kwargs,
return self.call_api(
method="POST",
data=data,
endpoint=self.endpoint,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
interactions:
- request:
body: '{"ticket_type": "author_create_user", "ticket_id": 123, "workflow": "00000000-0000-0000-0000-000000001521"}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '107'
Content-Type:
- application/json
method: POST
uri: http://host.docker.internal:8001/api/workflows/authors/tickets/
response:
body:
string: '{"id":2,"ticket_url":"https://cerntraining.service-now.com/nav_to.do?uri=/u_request_fulfillment.do?sys_id=123","workflow":"00000000-0000-0000-0000-000000001521","ticket_id":"123","ticket_type":"author_create_user","_created_at":"2024-12-19T13:52:15.812218Z","_updated_at":"2024-12-19T13:52:15.812236Z"}'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Content-Language:
- en
Content-Length:
- '302'
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Date:
- Thu, 19 Dec 2024 13:52:15 GMT
Referrer-Policy:
- same-origin
Server:
- WSGIServer/0.2 CPython/3.11.6
Server-Timing:
- TimerPanel_utime;dur=91.01899999996022;desc="User CPU time", TimerPanel_stime;dur=0.0;desc="System
CPU time", TimerPanel_total;dur=91.01899999996022;desc="Total CPU time", TimerPanel_total_time;dur=95.46066698385403;desc="Elapsed
time", SQLPanel_sql_time;dur=2.541333145927638;desc="SQL 7 queries", CachePanel_total_time;dur=0;desc="Cache
0 Calls"
Vary:
- Accept, Accept-Language, Cookie, origin
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
djdt-store-id:
- 6520019f804e49ab876111351992ec13
status:
code: 201
message: Created
version: 1
17 changes: 17 additions & 0 deletions workflows/tests/test_workflow_ticket_management_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest
from hooks.backoffice.workflow_ticket_management_hook import (
AuthorWorkflowTicketManagementHook,
)


class TestWorkflowTicketManagementHook:
workflow_ticket_management_hook = AuthorWorkflowTicketManagementHook()
test_workflow_id = "00000000-0000-0000-0000-000000001521"

@pytest.mark.vcr
def test_create_ticket_entry(self):
self.workflow_ticket_management_hook.create_ticket_entry(
workflow_id=self.test_workflow_id,
ticket_type="author_create_user",
ticket_id=123,
)

0 comments on commit a6f8655

Please sign in to comment.