commit d540f77b74e83cb322dc113e77e3c9be89c76b38 Author: Damian Johnson atagar@torproject.org Date: Tue Dec 24 16:49:39 2019 -0800
Test 'GETINFO dir/status-vote/*'
Adding test coverage for these GETINFO options...
https://github.com/torproject/stem/issues/29 --- test/integ/control/controller.py | 18 +++++++++++++++++- test/settings.cfg | 1 + 2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py index 059ad122..a32f66f0 100644 --- a/test/integ/control/controller.py +++ b/test/integ/control/controller.py @@ -14,6 +14,7 @@ import stem.connection import stem.control import stem.descriptor.reader import stem.descriptor.router_status_entry +import stem.directory import stem.response.protocolinfo import stem.socket import stem.util.str_tools @@ -257,7 +258,7 @@ class TestController(unittest.TestCase): @test.require.controller def test_getinfo_freshrelaydescs(self): """ - Exercises the GETINFO option status/fresh-relay-descs + Exercises 'GETINFO status/fresh-relay-descs'. """
with test.runner.get_runner().get_tor_controller() as controller: @@ -277,6 +278,21 @@ class TestController(unittest.TestCase): self.assertEqual(test.runner.ORPORT, server_desc.or_port)
@test.require.controller + @test.require.online + def test_getinfo_dir_status(self): + """ + Exercise 'GETINFO dir/status-vote/*'. + """ + + with test.runner.get_runner().get_tor_controller() as controller: + consensus = controller.get_info('dir/status-vote/current/consensus') + self.assertTrue('moria1' in consensus, 'moria1 not found in the consensus') + + if test.tor_version() >= stem.version.Version('0.4.3.1-alpha'): + microdescs = controller.get_info('dir/status-vote/current/consensus-microdesc') + self.assertTrue('moria1' in microdescs, 'moria1 not found in the microdescriptor consensus') + + @test.require.controller def test_get_version(self): """ Test that the convenient method get_version() works. diff --git a/test/settings.cfg b/test/settings.cfg index 2e7b7a80..2c18110f 100644 --- a/test/settings.cfg +++ b/test/settings.cfg @@ -32,6 +32,7 @@ integ.torrc |AssumeReachable 1 |DownloadExtraInfo 1 |ExitRelay 0 +|FetchUselessDescriptors 1 |LogTimeGranularity 1 |ProtocolWarnings 1 |PublishServerDescriptor 0