From 5eae0f6122c037401009961dd3a14ae4fd9738eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 8 Jan 2019 19:07:14 +0100 Subject: [PATCH] Added convenience url_for() wrapper for use in unit tests --- pillar/tests/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pillar/tests/__init__.py b/pillar/tests/__init__.py index 4286fb90..f40f7326 100644 --- a/pillar/tests/__init__.py +++ b/pillar/tests/__init__.py @@ -174,6 +174,10 @@ class AbstractPillarTest(TestMinimal): for modname in remove: del sys.modules[modname] + def url_for(self, endpoint, **values): + with self.app.app_context(): + return flask.url_for(endpoint, **values) + def ensure_file_exists(self, file_overrides=None, *, example_file=None) -> (ObjectId, dict): if example_file is None: example_file = ctd.EXAMPLE_FILE