This commit is contained in:
parent
94b154742e
commit
470f78c144
34
src/tests.py
Normal file
34
src/tests.py
Normal 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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user