PYRSS-Bot/src/tests.py
Corban-Lee Jones 470f78c144
Some checks failed
Build and Push Docker Image / build (push) Failing after 7m9s
write small test
2024-10-31 13:11:14 +00:00

34 lines
720 B
Python

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()