diff --git a/castle/failover/prepare_response.py b/castle/failover/prepare_response.py index ac31fee..d341c6c 100644 --- a/castle/failover/prepare_response.py +++ b/castle/failover/prepare_response.py @@ -9,6 +9,7 @@ def __init__(self, user_id, strategy=None, reason=None): def call(self): return dict( + policy={'action': self.strategy}, action=self.strategy, user_id=self.user_id, failover=True, diff --git a/castle/test/client_test.py b/castle/test/client_test.py index e1a58f7..d8033a3 100644 --- a/castle/test/client_test.py +++ b/castle/test/client_test.py @@ -116,6 +116,8 @@ def test_authenticate_tracked_true(self): @responses.activate def test_authenticate_tracked_true_status_500(self): response_text = { + 'policy': {'action': Verdict.ALLOW.value}, + 'action': Verdict.ALLOW.value, 'user_id': '1234', 'failover': True, @@ -133,6 +135,8 @@ def test_authenticate_tracked_true_status_500(self): def test_authenticate_tracked_false(self): response_text = { + 'policy': {'action': Verdict.ALLOW.value}, + 'action': Verdict.ALLOW.value, 'user_id': '1234', 'failover': True, @@ -183,6 +187,9 @@ def test_filter_tracked_true(self): @responses.activate def test_filter_tracked_true_status_500(self): response_text = { + + 'policy': {'action': Verdict.ALLOW.value}, + 'action': Verdict.ALLOW.value, 'user_id': '1234', 'failover': True, @@ -205,6 +212,8 @@ def test_filter_tracked_true_status_500(self): def test_filter_tracked_false(self): response_text = { + 'policy': {'action': Verdict.ALLOW.value}, + 'action': Verdict.ALLOW.value, 'user_id': '1234', 'failover': True, @@ -265,6 +274,8 @@ def test_risk_tracked_true(self): @responses.activate def test_risk_tracked_true_status_500(self): response_text = { + 'policy': {'action': Verdict.ALLOW.value}, + 'action': Verdict.ALLOW.value, 'user_id': '1234', 'failover': True, @@ -287,6 +298,9 @@ def test_risk_tracked_true_status_500(self): def test_risk_tracked_false(self): response_text = { + + 'policy': {'action': Verdict.ALLOW.value}, + 'action': Verdict.ALLOW.value, 'user_id': '1234', 'failover': True, @@ -327,6 +341,8 @@ def test_failover_strategy_not_throw(self): self.assertEqual( Client.failover_response_or_raise(options.get('user_id'), Exception()), { + 'policy': {'action': Verdict.ALLOW.value}, + 'action': Verdict.ALLOW.value, 'user_id': '1234', 'failover': True, diff --git a/castle/test/failover/prepare_response_test.py b/castle/test/failover/prepare_response_test.py index 0fe417b..7d7ff38 100644 --- a/castle/test/failover/prepare_response_test.py +++ b/castle/test/failover/prepare_response_test.py @@ -28,6 +28,7 @@ def test_call(self): self.assertDictEqual( failover_response.call(), { + 'policy': {'action': configuration.failover_strategy}, 'action': configuration.failover_strategy, 'user_id': user_id(), 'failover': True,