feat: install instruction inside web app
This commit is contained in:
@@ -3,7 +3,7 @@ from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
|
||||
import bot.app.web.subscription_webapp # noqa: F401
|
||||
from bot.app.web.webapp import common as common_module
|
||||
from bot.app.web.webapp import cache_helpers
|
||||
|
||||
|
||||
class WebappRedisCacheInvalidationTests(unittest.IsolatedAsyncioTestCase):
|
||||
@@ -14,8 +14,8 @@ class WebappRedisCacheInvalidationTests(unittest.IsolatedAsyncioTestCase):
|
||||
async def fake_delete(_settings, *keys):
|
||||
deleted.extend(keys)
|
||||
|
||||
with patch.object(common_module, "cache_delete", fake_delete):
|
||||
await common_module._invalidate_webapp_user_caches(
|
||||
with patch.object(cache_helpers, "cache_delete", fake_delete):
|
||||
await cache_helpers.invalidate_webapp_user_caches(
|
||||
settings,
|
||||
42,
|
||||
"42",
|
||||
@@ -33,6 +33,25 @@ class WebappRedisCacheInvalidationTests(unittest.IsolatedAsyncioTestCase):
|
||||
],
|
||||
)
|
||||
|
||||
async def test_invalidate_all_webapp_user_payloads_deletes_namespace_patterns(self):
|
||||
settings = SimpleNamespace(REDIS_URL="redis://redis:6379/0", REDIS_KEY_PREFIX="shop")
|
||||
patterns = []
|
||||
|
||||
async def fake_delete_pattern(_settings, pattern):
|
||||
patterns.append(pattern)
|
||||
return 0
|
||||
|
||||
with patch.object(cache_helpers, "cache_delete_pattern", fake_delete_pattern):
|
||||
await cache_helpers.invalidate_all_webapp_user_payloads(settings, include_devices=True)
|
||||
|
||||
self.assertEqual(
|
||||
patterns,
|
||||
[
|
||||
"shop:cache:webapp:me:*",
|
||||
"shop:cache:webapp:devices:*",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user