feature(tests): add unit tests

This commit is contained in:
2023-12-14 20:55:17 +00:00
parent d472dae69d
commit d213f1395d
12 changed files with 90 additions and 544 deletions

20
tests/test_img.py Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env python3
"""Provides test cases for webexmemebot/img.py."""
import pytest
from app import img # pragma: no cover
def test_get_templates() -> None:
"""Test to ensure that we can successfully contact the API."""
result = img.get_templates()
assert isinstance(result, list) and isinstance(result[0], dict)
@pytest.mark.parametrize("test_input,expected", img.CHAR_REPLACEMENTS)
def test_format_meme_string(test_input, expected):
"""Test to ensure we correctly reformat special chars in the meme URL."""
test_str: str = f"abc{test_input}123"
assert img.format_meme_string(test_str) == f"abc{expected}123"