On Thu, Jul 25, 2013 at 07:21:55PM +0400, Ivan Kluchnikov wrote:
2013/7/25 Holger Hans Peter Freyther
<holger(a)freyther.de>
Yes, I agree, tests are very important, I will try to
write one for this
command.
To help you I created the below snippet. You will just need to write
a new test method in there to do config and show configure. E.g. you
can issue all bar commands and verify that it shows up in the write
terminal command, then allow them again and see that it goes away.
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 3aa40f4..a3e29d3 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -55,6 +55,19 @@ class TestVTYBase(unittest.TestCase):
self.vty = None
osmoutil.end_proc(self.proc)
+class TestVTYNITB(TestVTYBase):
+
+ def vty_command(self):
+ return ["./src/osmo-nitb/osmo-nitb", "-c",
+ "doc/examples/osmo-nitb/nanobts/openbsc.cfg"]
+
+ def vty_app(self):
+ return (4242, "./src/osmo-nitb/osmo-nitb", "OpenBSC",
"nitb")
+
+ def testShowNetwork(self):
+ res = self.vty.command("show network")
+ print res
+
class TestVTYNAT(TestVTYBase):
@@ -138,6 +151,7 @@ if __name__ == '__main__':
os.chdir(workdir)
print "Running tests for specific VTY commands"
suite = unittest.TestSuite()
+ suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYNITB))
add_nat_test(suite, workdir)
res = unittest.TextTestRunner(verbosity=verbose_level).run(suite)
sys.exit(len(res.errors) + len(res.failures))