Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full coverage to meta_video_links rule #3036

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
WSLENV: FORCE_COLOR:PYTEST_REQPASS:TOXENV:GITHUB_STEP_SUMMARY
# Number of expected test passes, safety measure for accidental skip of
# tests. Update value if you add/remove tests.
PYTEST_REQPASS: 795
PYTEST_REQPASS: 796

steps:
- name: Activate WSL1
Expand Down
18 changes: 18 additions & 0 deletions test/rules/test_meta_video_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@
video_links:
- url: https://www.youtube.com/watch?v=aWmRepTSFKs&feature=youtu.be
title: Proper format
- url: https://drive.google.com/file/d/1spYR51l8SqQqvAhSdZE7/view
title: Check for VIDEO_REGEXP validity and break
- https://www.youtube.com/watch?v=aWmRepTSFKs&feature=youtu.be
- my_bad_key: https://www.youtube.com/watch?v=aWmRepTSFKs&feature=youtu.be
title: This has a bad key
- url: www.acme.com/vid
title: Bad format of url
"""

META_NO_GALAXY_INFO = """
galaxy_information:
video_links:
- url: https://www.youtube.com/watch?v=aWmRepTSFKs&feature=youtu.be
"""


def test_video_links() -> None:
"""Test meta_video_links."""
Expand All @@ -26,3 +34,13 @@ def test_video_links() -> None:
assert "Expected item in 'video_links' to be a dictionary" in str(results)
assert "'video_links' to contain only keys 'url' and 'title'" in str(results)
assert "URL format 'www.acme.com/vid' is not recognized" in str(results)


def test_meta_video_links_no_galaxy_info() -> None:
"""Test meta_video_links."""
collection = RulesCollection()
collection.register(MetaVideoLinksRule())
runner = RunFromText(collection)

results = runner.run_role_meta_main(META_NO_GALAXY_INFO)
assert len(results) == 0