fix(logging): write raw updates in production too
This commit is contained in:
1 parent
57f4c6cb4f
commit
d212e60eab
3 files changed
+19
-17
No files matched your search
+10
-12
@@ -92,15 +92,13 @@ class RawUpdateMiddlewareTests(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
|
||||
class RawUpdateModeTests(unittest.TestCase):
|
||||
def test_middleware_is_registered_only_for_development(self):
|
||||
dispatcher = Dispatcher()
|
||||
with patch.object(bot, "DEPLOY_ENV", "production"), patch.object(
|
||||
dispatcher.update, "outer_middleware"
|
||||
) as register:
|
||||
self.assertFalse(bot.configure_raw_update_logging(dispatcher))
|
||||
register.assert_not_called()
|
||||
with patch.object(bot, "DEPLOY_ENV", "development"), patch.object(
|
||||
dispatcher.update, "outer_middleware"
|
||||
) as register:
|
||||
self.assertTrue(bot.configure_raw_update_logging(dispatcher))
|
||||
register.assert_called_once()
|
||||
def test_middleware_is_registered_in_every_environment(self):
|
||||
"""Прод-бот тоже пишет сырые апдейты: групповые события видны только так."""
|
||||
for deploy_env in ("production", "development"):
|
||||
with self.subTest(deploy_env=deploy_env):
|
||||
dispatcher = Dispatcher()
|
||||
with patch.object(bot, "DEPLOY_ENV", deploy_env), patch.object(
|
||||
dispatcher.update, "outer_middleware"
|
||||
) as register:
|
||||
self.assertTrue(bot.configure_raw_update_logging(dispatcher))
|
||||
register.assert_called_once()
|
||||
Reference in new issue
Block a user