mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
Merge branch 'feature/designer' into feature/store-i18n
This commit is contained in:
34 files changed
+597
-186
No files matched your search
@@ -56,6 +56,48 @@ class TestApplicationsCarrierActionPlugin(unittest.TestCase):
|
||||
self.assertEqual(variables, {"applications": {}})
|
||||
self.assertTrue(kwargs["carrier"])
|
||||
|
||||
def test_revalidates_the_tokens_file_before_rendering(self):
|
||||
order = []
|
||||
lookup = _FakeLookup({"key": ["roles", []], "applications": {}})
|
||||
lookup.run = lambda *args, **kwargs: order.append("render") or [{}]
|
||||
action = _make_action(_FakeTask())
|
||||
with (
|
||||
patch(
|
||||
"plugins.action.applications_carrier.ActionBase.run",
|
||||
autospec=True,
|
||||
return_value={},
|
||||
),
|
||||
patch(
|
||||
"plugins.action.applications_carrier.lookup_loader.get",
|
||||
return_value=lookup,
|
||||
),
|
||||
patch(
|
||||
"plugins.action.applications_carrier.revalidate_tokens_file",
|
||||
side_effect=lambda variables: order.append(("revalidate", variables)),
|
||||
),
|
||||
):
|
||||
action.run(task_vars={"FILE_TOKENS": "/x/tokens.yml"})
|
||||
|
||||
self.assertEqual(
|
||||
order, [("revalidate", {"FILE_TOKENS": "/x/tokens.yml"}), "render"]
|
||||
)
|
||||
|
||||
def test_clear_does_not_revalidate(self):
|
||||
action = _make_action(_FakeTask(args={"clear": True}))
|
||||
with (
|
||||
patch(
|
||||
"plugins.action.applications_carrier.ActionBase.run",
|
||||
autospec=True,
|
||||
return_value={},
|
||||
),
|
||||
patch(
|
||||
"plugins.action.applications_carrier.revalidate_tokens_file"
|
||||
) as revalidate,
|
||||
):
|
||||
action.run(task_vars={})
|
||||
|
||||
revalidate.assert_not_called()
|
||||
|
||||
def test_rejects_arguments(self):
|
||||
action = _make_action(_FakeTask(args={"foo": 1}))
|
||||
with (
|
||||
|
||||
Reference in new issue
Block a user