[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [nyx/master] Couple minor argument tests



commit c2bb902f58e7060a58fabe4c0ce6f9e94fe3acf5
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Sep 10 08:29:17 2017 -0700

    Couple minor argument tests
    
    Just adding some basic coverage for the rest of the argument module.
---
 test/arguments.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/arguments.py b/test/arguments.py
index 454c3ca..da55127 100644
--- a/test/arguments.py
+++ b/test/arguments.py
@@ -4,7 +4,7 @@ Unit tests for nyx.arguments.
 
 import unittest
 
-from nyx.arguments import DEFAULT_ARGS, parse
+from nyx.arguments import DEFAULT_ARGS, parse, get_help, get_version
 
 
 class TestArgumentParsing(unittest.TestCase):
@@ -48,7 +48,7 @@ class TestArgumentParsing(unittest.TestCase):
   def test_that_we_reject_unrecognized_arguments(self):
     self.assertRaises(ValueError, parse, ['--blarg', 'stuff'])
 
-  def test_that_port_and_socket_unset_other(self):
+  def test_port_and_socket_unset_other(self):
     args = parse([])
     self.assertEqual(DEFAULT_ARGS['control_port'], args.control_port)
     self.assertEqual(DEFAULT_ARGS['control_socket'], args.control_socket)
@@ -80,3 +80,10 @@ class TestArgumentParsing(unittest.TestCase):
 
     for invalid_input in invalid_inputs:
       self.assertRaises(ValueError, parse, ['--interface', invalid_input])
+
+  def test_help(self):
+    self.assertTrue(get_help().startswith('Usage nyx [OPTION]'))
+    self.assertTrue('change control interface from 127.0.0.1:9051' in get_help())
+
+  def test_version(self):
+    self.assertTrue(get_version().startswith('nyx version'))

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits