Skip to content

Commit

Permalink
Test 'GETINFO dir/status-vote/*'
Browse files Browse the repository at this point in the history
Adding test coverage for these GETINFO options...

  #29
  • Loading branch information
atagar committed Dec 25, 2019
1 parent 7852f52 commit d540f77
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/integ/control/controller.py
Expand Up @@ -14,6 +14,7 @@
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
Expand Down Expand Up @@ -257,7 +258,7 @@ def test_getinfo(self):
@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:
Expand All @@ -276,6 +277,21 @@ def test_getinfo_freshrelaydescs(self):
self.assertEqual(controller.get_info('address'), server_desc.address)
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):
"""
Expand Down
1 change: 1 addition & 0 deletions test/settings.cfg
Expand Up @@ -32,6 +32,7 @@ integ.torrc
|AssumeReachable 1
|DownloadExtraInfo 1
|ExitRelay 0
|FetchUselessDescriptors 1
|LogTimeGranularity 1
|ProtocolWarnings 1
|PublishServerDescriptor 0
Expand Down

0 comments on commit d540f77

Please sign in to comment.