write small test
Some checks failed
Build and Push Docker Image / build (push) Failing after 7m9s

This commit is contained in:
Corban-Lee Jones 2024-10-31 13:11:14 +00:00
parent 94b154742e
commit 470f78c144

34
src/tests.py Normal file
View File

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