[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Digest validation fails for 'non-ascii_descriptor'
commit bf5bac34abf95f1e12f0ce4030c305c364939c1f
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Mon Mar 18 13:34:41 2013 -0700
Digest validation fails for 'non-ascii_descriptor'
The 'non-ascii_descriptor' test descriptor fails digest validation due to being
slightly modified. Finding that descriptor was a PITA so simply mocking out the
digest validation rather than trying to dig up the original.
---
test/integ/descriptor/reader.py | 5 +++++
test/integ/descriptor/server_descriptor.py | 6 ++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/test/integ/descriptor/reader.py b/test/integ/descriptor/reader.py
index 3ed47ae..59e9c8c 100644
--- a/test/integ/descriptor/reader.py
+++ b/test/integ/descriptor/reader.py
@@ -12,6 +12,7 @@ import time
import unittest
import stem.descriptor.reader
+import test.mocking
import test.runner
from stem.util import system
@@ -85,6 +86,8 @@ class SkipListener:
class TestDescriptorReader(unittest.TestCase):
def tearDown(self):
+ test.mocking.revert_mocking()
+
# cleans up 'processed file' listings that we made
test_listing_path = _get_processed_files_path()
@@ -377,6 +380,8 @@ class TestDescriptorReader(unittest.TestCase):
plaintext non-descriptor files.
"""
+ test.mocking.mock_method(stem.descriptor.server_descriptor.RelayDescriptor, '_validate_content', test.mocking.no_op())
+
skip_listener = SkipListener()
reader = stem.descriptor.reader.DescriptorReader(DESCRIPTOR_TEST_DATA)
reader.register_skip_listener(skip_listener.listener)
diff --git a/test/integ/descriptor/server_descriptor.py b/test/integ/descriptor/server_descriptor.py
index fb2e2b3..ec7c464 100644
--- a/test/integ/descriptor/server_descriptor.py
+++ b/test/integ/descriptor/server_descriptor.py
@@ -13,12 +13,16 @@ import stem.descriptor
import stem.descriptor.server_descriptor
import stem.exit_policy
import stem.version
+import test.mocking
import test.runner
from test.integ.descriptor import get_resource
class TestServerDescriptor(unittest.TestCase):
+ def tearDown(self):
+ test.mocking.revert_mocking()
+
def test_metrics_descriptor(self):
"""
Parses and checks our results against a server descriptor from metrics.
@@ -190,6 +194,8 @@ Qlx9HNCqCY877ztFRC624ja2ql6A2hBcuoYMbkHjcQ4=
Parses a descriptor with non-ascii content.
"""
+ test.mocking.mock_method(stem.descriptor.server_descriptor.RelayDescriptor, '_validate_content', test.mocking.no_op())
+
descriptor_file = open(get_resource("non-ascii_descriptor"), 'rb')
expected_contact = b"2048R/F171EC1F Johan Bl\xc3\xa5b\xc3\xa4ck \xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf".decode("utf-8", "replace")
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits