[Git][NTPsec/ntpsec][master] Added test for ReslistSummary()
Ian Bruene
gitlab at mg.gitlab.com
Thu Aug 31 23:01:39 UTC 2017
Ian Bruene pushed to branch master at NTPsec / ntpsec
Commits:
b6c5bfcb by Ian Bruene at 2017-08-31T18:00:31-05:00
Added test for ReslistSummary()
- - - - -
1 changed file:
- tests/pylib/test_util.py
Changes:
=====================================
tests/pylib/test_util.py
=====================================
--- a/tests/pylib/test_util.py
+++ b/tests/pylib/test_util.py
@@ -802,5 +802,28 @@ class TestPylibUtilMethods(unittest.TestCase):
ntp.util.canonicalization_cache = cachetemp
ntp.util.canonicalize_dns = cdnstemp
+ def test_ReslistSummary(self):
+ c = ntp.util.ReslistSummary
+ m = ntp.util.ReslistSummary._ReslistSummary__getPrefix
+
+ # Test __getPrefix
+ # Test empty
+ self.assertEqual(m(""), "/0")
+ # Test base 16
+ self.assertEqual(m("FF:FF:F0:00"), "/20")
+ # Test base 10
+ self.assertEqual(m("255.240.0.0"), "/12")
+ # Test summary
+ # Test with everything
+ cls = c()
+ data = {"hits": "blah", "addr": "42.23.1.2",
+ "mask": "FF:FF:0:0", "flags": "qwerty"}
+ self.assertEqual(cls.summary(data),
+ " blah 42.23.1.2/16\n qwerty\n")
+ # Test with missing data
+ data = {"addr": "42.23.1.2", "mask": "FF:FF:0:0"}
+ self.assertEqual(cls.summary(data),
+ " 42.23.1.2/16\n \n")
+
if __name__ == '__main__':
unittest.main()
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b6c5bfcb5aab107a47ace182877a32b1d6c59a29
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b6c5bfcb5aab107a47ace182877a32b1d6c59a29
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170831/4fd15cea/attachment.html>
More information about the vc
mailing list