Commits

Anonymous committed 5a6598b

anonymize_ip test case

  • Participants
  • Parent commits 45998e0

Comments (0)

Files changed (1)

File tests/utils.py

+import unittest
+import sys
+sys.path.insert(0, '..')
+
+from pyga import utils
+
+
+class TestAnonymizeIp(unittest.TestCase):
+    def test_with_no_ip(self):
+    	self.assertEqual("", utils.anonymize_ip(""))
+
+    def test_with_valid_ip(self):
+    	self.assertEqual("1.2.3.0", utils.anonymize_ip("1.2.3.4"))
+    	self.assertEqual("192.168.137.0", utils.anonymize_ip("192.168.137.123"))
+
+
+if __name__ == '__main__':
+	unittest.main()