Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions castle/failover/prepare_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions castle/test/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions castle/test/failover/prepare_response_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down