Test isIp, isPrivateIp

This commit is contained in:
shortcutme 2018-12-19 13:25:20 +01:00
parent 45add916f4
commit bda238344c
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -36,4 +36,15 @@ class TestHelper:
assert helper.getFilename("") == ""
assert helper.getFilename("content.json") == "content.json"
assert helper.getFilename("data/users/") == ""
assert helper.getFilename("/data/users/content.json") == "content.json"
assert helper.getFilename("/data/users/content.json") == "content.json"
def testIsIp(self):
assert helper.isIp("1.2.3.4")
assert helper.isIp("255.255.255.255")
assert not helper.isIp("any.host")
assert not helper.isIp("1.2.3.4.com")
assert not helper.isIp("1.2.3.4.any.host")
def testIsPrivateIp(self):
assert helper.isPrivateIp("192.168.1.1")
assert not helper.isPrivateIp("1.1.1.1")