diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-11-07 14:42:58 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-11-07 14:42:58 -0500 |
commit | 940d286a7493ba890f89f17cc5c70c3e37a7ccd0 (patch) | |
tree | b7ab281db51dd27634db8c8de810594aba4939b0 /src/test/test_cmdline_args.py | |
parent | 86cfc64d4565187250c8b92d25c24a1c5a0bec0d (diff) | |
download | tor-940d286a7493ba890f89f17cc5c70c3e37a7ccd0.tar.gz tor-940d286a7493ba890f89f17cc5c70c3e37a7ccd0.zip |
Documentation and tests for 10060
Diffstat (limited to 'src/test/test_cmdline_args.py')
-rwxr-xr-x | src/test/test_cmdline_args.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/test_cmdline_args.py b/src/test/test_cmdline_args.py index 2213bb5702..e8edaa0263 100755 --- a/src/test/test_cmdline_args.py +++ b/src/test/test_cmdline_args.py @@ -60,6 +60,10 @@ def strip_log_junk(line): return ""+line return m.group(2).strip() +def randstring(entropy_bytes): + s = os.urandom(entropy_bytes) + return binascii.b2a_hex(s) + class CmdlineTests(unittest.TestCase): def test_version(self): @@ -247,5 +251,17 @@ class CmdlineTests(unittest.TestCase): "ORPort 9003", "SocksPort 9090"]) + def test_missing_torrc(self): + fname = "nonexistent_file_"+randstring(8) + out = run_tor(["-f", fname, "--verify-config"], failure=True) + ln = [ strip_log_junk(l) for l in lines(out) ] + self.assert_("Unable to open configuration file" in ln[-2]) + self.assert_("Reading config failed" in ln[-1]) + + out = run_tor(["-f", fname, "--verify-config", "--ignore-missing-torrc"]) + ln = [ strip_log_junk(l) for l in lines(out) ] + self.assert_(", using reasonable defaults" in ln[-2]) + self.assert_("Configuration was valid" in ln[-1]) + if __name__ == '__main__': unittest.main() |