[Git][NTPsec/ntpsec][master] 2 commits: Added test for IfstatsSummary()
Ian Bruene
gitlab at mg.gitlab.com
Thu Aug 31 23:44:59 UTC 2017
Ian Bruene pushed to branch master at NTPsec / ntpsec
Commits:
0c005b37 by Ian Bruene at 2017-08-31T18:41:55-05:00
Added test for IfstatsSummary()
- - - - -
36f1d1d0 by Ian Bruene at 2017-08-31T18:44:15-05:00
Fixed broken 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
@@ -822,8 +822,30 @@ class TestPylibUtilMethods(unittest.TestCase):
" 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")
+ self.assertEqual(cls.summary(data), "")
+
+ def test_IfstatsSummary(self):
+ c = ntp.util.IfstatsSummary
+ od = ntp.util.OrderedDict
+
+ cls = c()
+ # Test with all variables available
+ data = od((("addr", "1.2.3.4"), ("bcast", "foo"),
+ ("name", "Namus Maximus"), ("en", True), ("flags", 0xFACE),
+ ("rx", 12), ("tx", 34), ("txerr", 56), ("pc", 78),
+ ("up", 90)))
+ self.assertEqual(cls.summary(1, data),
+ " 1 Namus Maximus . face 12 34"
+ " 56 78 90\n 1.2.3.4\n foo\n")
+ # Test without bcast
+ data = od((("addr", "1.2.3.4"), ("name", "Namus Maximus"),
+ ("en", True), ("flags", 0xFACE), ("rx", 12), ("tx", 34),
+ ("txerr", 56), ("pc", 78), ("up", 90)))
+ self.assertEqual(cls.summary(1, data),
+ " 1 Namus Maximus . face 12 34"
+ " 56 78 90\n 1.2.3.4\n")
+ # Test with missing data
+ self.assertEqual(cls.summary(1, od()), "")
if __name__ == '__main__':
unittest.main()
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/b6c5bfcb5aab107a47ace182877a32b1d6c59a29...36f1d1d09d130b4d534b19738488c300633c091e
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/b6c5bfcb5aab107a47ace182877a32b1d6c59a29...36f1d1d09d130b4d534b19738488c300633c091e
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/23758cab/attachment.html>
More information about the vc
mailing list