Skip to content

Commit 4dd6a55

Browse files
author
Maria Korlotian
authored
Add process response tests (#86)
1 parent bc201b6 commit 4dd6a55

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

castle/test/core/process_response_test.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,35 @@ def test_response_none(self):
2121
def test_response_empty(self):
2222
self.assertEqual(CoreProcessResponse(response(body=b'')).call(), {})
2323

24-
def test_response_authenticate(self):
24+
def test_response_authenticate_allow(self):
2525
self.assertEqual(
2626
CoreProcessResponse(
2727
response(body=b'{"action":"allow","user_id":"12345"}')).call(),
2828
{"action": "allow", "user_id": "12345"}
2929
)
3030

31+
def test_response_authenticate_allow_with_props(self):
32+
self.assertEqual(
33+
CoreProcessResponse(
34+
response(body=b'{"action":"allow","user_id":"12345","internal":{}}')).call(),
35+
{"action": "allow", "user_id": "12345", "internal": {}}
36+
)
37+
38+
def test_response_authenticate_deny_without_rp(self):
39+
self.assertEqual(
40+
CoreProcessResponse(
41+
response(body=b'{"action":"deny","user_id":"1","device_token":"abc"}')).call(),
42+
{"action": "deny", "user_id": "1", "device_token": "abc"}
43+
)
44+
45+
def test_response_authenticate_deny_with_rp(self):
46+
self.assertEqual(
47+
CoreProcessResponse(
48+
response(body=b'{"action":"deny","user_id":"1","device_token":"abc","risk_policy":{"id":"123","revision_id":"abc","name":"def","type":"bot"}}')).call(),
49+
{"action": "deny", "user_id": "1", "device_token": "abc", "risk_policy": {
50+
"id": "123", "revision_id": "abc", "name": "def", "type": "bot"}}
51+
)
52+
3153
def test_verify_200_299(self):
3254
for status_code in range(200, 299):
3355
self.assertEqual(

0 commit comments

Comments
 (0)