Debian Codegraph @

tests/wire/test_actions.py

raw symbols SCIP
1 from .conftest import get_client, verify_request_count
2
3 from auth0.management import ActionTrigger
4
5
6 def test_actions_list_() -> None:
7 """Test list endpoint with WireMock"""
8 test_id = "actions.list_.0"
9 client = get_client(test_id)
10 client.actions.list(
11 trigger_id="post-login",
12 action_name="actionName",
13 deployed=True,
14 page=1,
15 per_page=1,
16 installed=True,
17 )
18 verify_request_count(
19 test_id,
20 "GET",
21 "/actions/actions",
22 {
23 "triggerId": "post-login",
24 "actionName": "actionName",
25 "deployed": "true",
26 "page": "1",
27 "per_page": "1",
28 "installed": "true",
29 },
30 1,
31 )
32
33
34 def test_actions_create() -> None:
35 """Test create endpoint with WireMock"""
36 test_id = "actions.create.0"
37 client = get_client(test_id)
38 client.actions.create(
39 name="name",
40 supported_triggers=[
41 ActionTrigger(
42 id="post-login",
43 )
44 ],
45 )
46 verify_request_count(test_id, "POST", "/actions/actions", None, 1)
47
48
49 def test_actions_get() -> None:
50 """Test get endpoint with WireMock"""
51 test_id = "actions.get.0"
52 client = get_client(test_id)
53 client.actions.get(
54 id="id",
55 )
56 verify_request_count(test_id, "GET", "/actions/actions/id", None, 1)
57
58
59 def test_actions_delete() -> None:
60 """Test delete endpoint with WireMock"""
61 test_id = "actions.delete.0"
62 client = get_client(test_id)
63 client.actions.delete(
64 id="id",
65 force=True,
66 )
67 verify_request_count(test_id, "DELETE", "/actions/actions/id", {"force": "true"}, 1)
68
69
70 def test_actions_update() -> None:
71 """Test update endpoint with WireMock"""
72 test_id = "actions.update.0"
73 client = get_client(test_id)
74 client.actions.update(
75 id="id",
76 )
77 verify_request_count(test_id, "PATCH", "/actions/actions/id", None, 1)
78
79
80 def test_actions_deploy() -> None:
81 """Test deploy endpoint with WireMock"""
82 test_id = "actions.deploy.0"
83 client = get_client(test_id)
84 client.actions.deploy(
85 id="id",
86 )
87 verify_request_count(test_id, "POST", "/actions/actions/id/deploy", None, 1)
88
89
90 def test_actions_test() -> None:
91 """Test test endpoint with WireMock"""
92 test_id = "actions.test.0"
93 client = get_client(test_id)
94 client.actions.test(
95 id="id",
96 payload={"key": "value"},
97 )
98 verify_request_count(test_id, "POST", "/actions/actions/id/test", None, 1)