From 01771085df1578a7cdc5501535839f868e7b4687 Mon Sep 17 00:00:00 2001 From: Rudi Giesler Date: Wed, 4 Mar 2015 12:48:00 +0200 Subject: [PATCH] Added tests for inbound message credit cutoff --- go/vumitools/tests/test_billing_worker.py | 33 ++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/go/vumitools/tests/test_billing_worker.py b/go/vumitools/tests/test_billing_worker.py index 35187525f..ccb942446 100644 --- a/go/vumitools/tests/test_billing_worker.py +++ b/go/vumitools/tests/test_billing_worker.py @@ -772,8 +772,39 @@ def test_outbound_message_credit_cutoff_message(self): "outbound", user_account="12345", tag=("pool1", "1234"), - helper_metadata={}, + helper_metadata={} ) published_msgs = self.ri_helper.get_dispatched_outbound() self.assertEqual(len(published_msgs), 0) + + @inlineCallbacks + def test_inbound_message_credit_cutoff_session(self): + self.billing_api = BillingApiMock(credit_cutoff=True) + yield self.get_dispatcher + + msg = yield self.make_dispatch_inbound( + "inbound", + user_account="12345", + tag=("pool1", "1234"), + helper_metadata={}, + session_event='new' + ) + + published_msg = self.ri_helper.get_dispatched_inbound()[0] + self.assertEqual(msg, published_msg) + + @inlineCallbacks + def test_inbound_message_credit_cutoff_message(self): + self.billing_api = BillingApiMock(credit_cutoff=True) + yield self.get_dispatcher + + msg = yield self.make_dispatch_inbound( + "inbound", + user_account="12345", + tag=("pool1", "1234"), + helper_metadata={} + ) + + published_msg = self.ri_helper.get_dispatched_inbound()[0] + self.assertEqual(msg, published_msg)