diff --git a/src/tests.py b/src/tests.py new file mode 100644 index 0000000..504ca34 --- /dev/null +++ b/src/tests.py @@ -0,0 +1,34 @@ + +import re + + +def test_content_filters(): + from models import ContentFilter, MatchingAlgorithm + + content_filter = ContentFilter( + id=0, + server_id=0, + name="Test Filter", + matching_pattern="postcode lottery", + matching_algorithm=MatchingAlgorithm.LITERAL, + is_insensitive=True, + is_whitelist=False + ) + + entry = { + "title": "This is the Title of the test Entry", + "description": "This is the description for the postcode lottery" + } + + # Should match 'Test' in entry title with the pattern + assert content_filter.matches(entry) == True + + print("success") + + +def main(): + test_content_filters() + +if __name__ == "__main__": + main() + \ No newline at end of file