[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Add integ test for GETINFO status/fresh-relay-descs
commit f5652c9b069ff5a71150266ada1a6ddb65c5eb98
Author: hannelorestetx <hannelores.x@xxxxxxxxxxx>
Date: Mon Dec 9 16:24:35 2019 -0500
Add integ test for GETINFO status/fresh-relay-descs
---
test/integ/control/controller.py | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 6e45d0fa..d145272e 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -255,6 +255,42 @@ class TestController(unittest.TestCase):
self.assertEqual({}, controller.get_info([], {}))
@test.require.controller
+ def test_getinfo_freshrelaydescs(self):
+ """
+ Exercises the GETINFO option status/fresh-relay-descs
+ """
+
+ runner = test.runner.get_runner()
+
+ with runner.get_tor_controller() as controller:
+ controller.set_conf("Address", "1.2.3.4")
+ relay_descs = controller.get_info('status/fresh-relay-descs')
+
+ # check that both the server descriptor and extra info parts exist in
+ # the response by looking for the 'extra-info' entry
+ relay_descs = relay_descs.split("extra-info ")
+ self.assertTrue(len(relay_descs) == 2)
+
+ # check integrity and compliance of descriptors by parsing with
+ # validate flags on
+ server_desc = \
+ stem.descriptor.server_descriptor.ServerDescriptor(relay_descs[0],
+ validate = True)
+ extra_info = \
+ stem.descriptor.extrainfo_descriptor.\
+ ExtraInfoDescriptor("extra-info " + relay_descs[1],
+ validate = True)
+
+ # check the contents of a few fields: as retrieved from controller;
+ # as compared between descriptors; as set by SETCONF; and as set by
+ # torrc
+ self.assertTrue(extra_info.nickname == server_desc.nickname ==
+ controller.get_conf("Nickname"))
+ self.assertEqual(server_desc.fingerprint, extra_info.fingerprint)
+ self.assertEqual(server_desc.address, "1.2.3.4")
+ self.assertEqual(1113, server_desc.or_port)
+
+ @test.require.controller
def test_get_version(self):
"""
Test that the convenient method get_version() works.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits