Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
edudouglas committed Dec 17, 2018
1 parent 628cdd6 commit 5a2ed1e
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions temba/ivr/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2478,9 +2478,8 @@ def test_ivr_recording_with_imimobile(self):

self.assertContains(response, "<prompt>Thank you for the recording.</prompt>", status_code=200)

@patch("requests.post")
def test_imimobile_failed_response(self, mock_create_call):
with self.assertRaises(IVRException):
def test_imimobile_failed_response(self):
with patch("requests.post") as mock_post:
channel = Channel.create(
self.org, self.org.get_user(), "IN", "IMI", "+123456789", "+123456789", dict(), "C"
)
Expand All @@ -2489,29 +2488,14 @@ def test_imimobile_failed_response(self, mock_create_call):
flow = Flow.objects.get(name="Voice Flow")
ben = self.create_contact("Ben", "+12345")

mock_post.return_value = MockResponse(200, json.dumps(dict(status=1, description="TransId required")))

flow.start([], [ben], restart_participants=True)
call = IVRCall.objects.filter(direction=IVRCall.OUTGOING).first()
mock_create_call.return_value = MockResponse(
200, json.dumps(dict(status=1, description="TransId required"))
)

imimobile_client = self.org.get_imimobile_client()
imimobile_client.start_call(call, "+13603621737", channel.address, None)
with self.assertRaises(IVRException):
imimobile_client.start_call(call, "+13603621737", channel.address, None)

call.refresh_from_db()
self.assertEqual(ChannelSession.FAILED, call.status)

# def test_disable_calls_imimobile(self):
# channel = Channel.create(self.org, self.org.get_user(), "IN", "IMI", "+123456789", "+123456789", dict(), "C")

# self.get_flow("ivr_child_flow")
# flow = Flow.objects.get(name="Voice Flow")
# ben = self.create_contact("Ben", "+12345")

# with self.settings(SEND_CALLS=False):
# flow.start([], [ben], restart_participants=True)
# call = IVRCall.objects.filter(direction=IVRCall.OUTGOING).first()

# imimobile_client = self.org.get_imimobile_client()
# with self.assertRaises(ValueError):
# imimobile_client.start_call(call, "+13603621737", channel.address, None)
# self.assertEqual(ChannelSession.FAILED, call.status)

0 comments on commit 5a2ed1e

Please sign in to comment.