diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:04:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:04:50 +0000 |
commit | 782f8df6e41f29dce2db4970a3ad84aaeb7d8c5f (patch) | |
tree | 3a88a542cd8074743d251881131510157cfc510b /test/TestMetaVideoLinks.py | |
parent | Initial commit. (diff) | |
download | ansible-lint-upstream.tar.xz ansible-lint-upstream.zip |
Adding upstream version 4.3.7.upstream/4.3.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/TestMetaVideoLinks.py')
-rw-r--r-- | test/TestMetaVideoLinks.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/TestMetaVideoLinks.py b/test/TestMetaVideoLinks.py new file mode 100644 index 0000000..4d61891 --- /dev/null +++ b/test/TestMetaVideoLinks.py @@ -0,0 +1,35 @@ +# pylint: disable=preferred-module # FIXME: remove once migrated per GH-725 +import unittest + +from ansiblelint.rules import RulesCollection +from ansiblelint.rules.MetaVideoLinksRule import MetaVideoLinksRule +from ansiblelint.testing import RunFromText + +META_VIDEO_LINKS = ''' +galaxy_info: + video_links: + - url: https://youtu.be/aWmRepTSFKs + title: Proper format + - https://youtu.be/this_is_not_a_dictionary + - my_bad_key: https://youtu.be/aWmRepTSFKs + title: This has a bad key + - url: www.myvid.com/vid + title: Bad format of url +''' + + +class TestMetaVideoLinks(unittest.TestCase): + collection = RulesCollection() + collection.register(MetaVideoLinksRule()) + + def setUp(self): + self.runner = RunFromText(self.collection) + + def test_video_links(self): + results = self.runner.run_role_meta_main(META_VIDEO_LINKS) + self.assertIn("Expected item in 'video_links' to be a dictionary", + str(results)) + self.assertIn("'video_links' to contain only keys 'url' and 'title'", + str(results)) + self.assertIn("URL format 'www.myvid.com/vid' is not recognized", + str(results)) |