commit 5f65f718a15e4c53b6422f89a369db9e95b57fe4 Author: Damian Johnson <ata...@torproject.org> Date: Tue Sep 29 19:17:07 2020 -0700
Test read_with_parse_file example --- test/unit/examples.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/unit/examples.py b/test/unit/examples.py index 6e32a0f2..9d42299d 100644 --- a/test/unit/examples.py +++ b/test/unit/examples.py @@ -785,8 +785,14 @@ class TestExamples(unittest.TestCase): self.assertEqual('I got a BW event for 15 bytes downloaded and 25 bytes uploaded\n', stdout_mock.getvalue()) - def test_read_with_parse_file(self): - pass + @patch('stem.descriptor.parse_file') + @patch('sys.stdout', new_callable = io.StringIO) + def test_read_with_parse_file(self, stdout_mock, parse_file_mock): + parse_file_mock.return_value = [RelayDescriptor.create({'fingerprint': '4F0C 867D F0EF 6816 0568 C826 838F 482C EA7C FE44'})] + + import read_with_parse_file + + self.assertEqual('4F0C867DF0EF68160568C826838F482CEA7CFE44\n', stdout_mock.getvalue()) def test_reading_twitter(self): pass _______________________________________________ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits