36 lines
760 B
Python
36 lines
760 B
Python
"""
|
|
Test check andling for regex checks
|
|
"""
|
|
|
|
import re
|
|
from corelibs.check_handling.regex_constants import DOMAIN_WITH_LOCALHOST_REGEX
|
|
|
|
|
|
def main():
|
|
"""
|
|
Test regex checks
|
|
"""
|
|
test_domains = [
|
|
"example.com",
|
|
"localhost",
|
|
"subdomain.localhost",
|
|
"test.localhost.com",
|
|
"some-domain.org"
|
|
]
|
|
|
|
regex_domain_check = re.compile(DOMAIN_WITH_LOCALHOST_REGEX)
|
|
print(f"REGEX: {DOMAIN_WITH_LOCALHOST_REGEX}")
|
|
print(f"Check regex: {regex_domain_check.search('localhost')}")
|
|
|
|
for domain in test_domains:
|
|
if regex_domain_check.search(domain):
|
|
print(f"Matched: {domain}")
|
|
else:
|
|
print(f"Did not match: {domain}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|
|
# __END__
|