[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Test validate_descriptor_content example
commit 00dd6cdd072ec1ee1ce6788d61236623740bf048
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Fri Oct 2 13:35:23 2020 -0700
Test validate_descriptor_content example
---
test/unit/examples.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/test/unit/examples.py b/test/unit/examples.py
index 8d0f3b3e..b713932c 100644
--- a/test/unit/examples.py
+++ b/test/unit/examples.py
@@ -991,8 +991,16 @@ class TestExamples(unittest.TestCase):
self.assertEqual(EXPECTED_UTILITIES, stdout_mock.getvalue())
- def test_validate_descriptor_content(self):
- pass
+ @patch('stem.descriptor.parse_file')
+ @patch('sys.stdout', new_callable = io.StringIO)
+ def test_validate_descriptor_content(self, stdout_mock, parse_file_mock):
+ parse_file_mock.return_value = [RouterStatusEntryV3.create({
+ 'r': 'caerSidi p1aag7VwarGxqctS7/fS0y5FU+s oQZFLYe9e4A7bOkWKR7TaNxb0JE 2012-08-06 11:19:31 71.35.150.29 9001 0',
+ })]
+
+ import validate_descriptor_content
+
+ self.assertEqual('found relay caerSidi (A7569A83B5706AB1B1A9CB52EFF7D2D32E4553EB)\n', stdout_mock.getvalue())
@patch('stem.descriptor.remote.DescriptorDownloader.query')
@patch('stem.directory.Authority.from_cache')
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits