Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

logging: Remove unncessary logging patches in backend tests.

m-e-l-u-h-a-n7417ac9165c2
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index 1ca62aa08e6..9c0f2207f87 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -1674,8 +1674,7 @@ class StripeTest(StripeTestCase):
self.assertIsNone(plan.next_invoice_date)
self.assertEqual(plan.status, CustomerPlan.ENDED)
- @patch("corporate.lib.stripe.billing_logger.info")
- def test_downgrade_free_trial(self, mock_: Mock) -> None:
+ def test_downgrade_free_trial(self) -> None:
user = self.example_user("hamlet")
free_trial_end_date = self.now + timedelta(days=60)
@@ -1757,8 +1756,7 @@ class StripeTest(StripeTestCase):
self.assertEqual(old_plan.next_invoice_date, None)
self.assertEqual(old_plan.status, CustomerPlan.ENDED)
- @patch("corporate.lib.stripe.billing_logger.info")
- def test_deactivate_realm(self, mock_: Mock) -> None:
+ def test_deactivate_realm(self) -> None:
user = self.example_user("hamlet")
with patch("corporate.lib.stripe.timezone_now", return_value=self.now):
self.local_upgrade(self.seat_count, True, CustomerPlan.ANNUAL, 'token')
@@ -1801,8 +1799,7 @@ class StripeTest(StripeTestCase):
invoice_plans_as_needed(self.next_year)
mocked.assert_not_called()
- @patch("corporate.lib.stripe.billing_logger.info")
- def test_reupgrade_by_billing_admin_after_realm_deactivation(self, mock_: Mock) -> None:
+ def test_reupgrade_by_billing_admin_after_realm_deactivation(self) -> None:
user = self.example_user("hamlet")
with patch("corporate.lib.stripe.timezone_now", return_value=self.now):
diff --git a/zerver/tests/test_cache.py b/zerver/tests/test_cache.py
index da37be067da..c9715046bf9 100644
--- a/zerver/tests/test_cache.py
+++ b/zerver/tests/test_cache.py
@@ -177,10 +177,8 @@ class GetCacheWithKeyDecoratorTest(ZulipTestCase):
return
hamlet = self.example_user('hamlet')
- with patch('zerver.lib.cache.logger.warning') as mock_warn:
- with self.assertRaises(NotFoundInCache):
- get_user_function_with_good_cache_keys(hamlet.id)
- mock_warn.assert_not_called()
+ with self.assertRaises(NotFoundInCache):
+ get_user_function_with_good_cache_keys(hamlet.id)
cache_set(good_cache_key_function(hamlet.id), hamlet)
result = get_user_function_with_good_cache_keys(hamlet.id)
diff --git a/zerver/tests/test_queue_worker.py b/zerver/tests/test_queue_worker.py
index 00e8aec3889..de91f9f75b1 100644
--- a/zerver/tests/test_queue_worker.py
+++ b/zerver/tests/test_queue_worker.py
@@ -424,8 +424,7 @@ class WorkerTest(ZulipTestCase):
worker.setup()
with patch('zerver.lib.actions.send_email'), \
patch('zerver.worker.queue_processors.send_future_email') \
- as send_mock, \
- patch('logging.info'):
+ as send_mock:
worker.start()
self.assertEqual(send_mock.call_count, 2)
diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py
index 0f11226b078..e9a1d24a90c 100644
--- a/zerver/tests/test_signup.py
+++ b/zerver/tests/test_signup.py
@@ -556,12 +556,11 @@ class PasswordResetTest(ZulipTestCase):
# If the domain doesn't match, we do generate an email
with self.settings(LDAP_APPEND_DOMAIN="example.com"):
email = self.example_email("hamlet")
- with patch('logging.info') as mock_logging:
- result = self.client_post('/accounts/password/reset/', {'email': email})
- self.assertEqual(result.status_code, 302)
- self.assertTrue(result["Location"].endswith(
- "/accounts/password/reset/done/"))
- result = self.client_get(result["Location"])
+ result = self.client_post('/accounts/password/reset/', {'email': email})
+ self.assertEqual(result.status_code, 302)
+ self.assertTrue(result["Location"].endswith(
+ "/accounts/password/reset/done/"))
+ result = self.client_get(result["Location"])
body = self.get_reset_mail_body()
self.assertIn('reset your password', body)