Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
refactor: rewrite is_valid_port() #7360
DO NOT DELETE THIS TEXT
If you would like to test this pull request then please run:
Take two. Fixed the error and added tests.
Higher level tests are almost universally better. They test more and the right things. Also allow for refactoring without re-writing tests.
We can't go all the way to the top level with librenms tests right now, so, we build up from the bottom. The OS discovery tests are about right. They take input from the outside (snmp) and produce output to the user (os type).
The best way to test this code would be to add some snmprec that has ports. Then set some config variables and verify that the correct ports are ignored. That is kinda difficult, but the closer we get to that the more useful our tests are.