[tor-commits] [stem/master] Including signature method in DocumentSignature's comparison

atagar at torproject.org atagar at torproject.org
Sat Feb 2 18:20:49 UTC 2013


commit 4f108d1dffd2e23db8ced6d4cb755a336a0767f3
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Jan 25 09:57:54 2013 -0800

    Including signature method in DocumentSignature's comparison
    
    The DocumentSignature's method argument is new-ish, and its comparison function
    wasn't taking it into account. Both fixing this and using the default method
    (sha1) in the mock instance so our tests still pass.
---
 stem/descriptor/networkstatus.py |    2 +-
 test/mocking.py                  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/descriptor/networkstatus.py b/stem/descriptor/networkstatus.py
index 511f5b0..f17d705 100644
--- a/stem/descriptor/networkstatus.py
+++ b/stem/descriptor/networkstatus.py
@@ -1352,7 +1352,7 @@ class DocumentSignature(object):
     if not isinstance(other, DocumentSignature):
       return False
 
-    for attr in ("identity", "key_digest", "signature"):
+    for attr in ("method", "identity", "key_digest", "signature"):
       if getattr(self, attr) != getattr(other, attr):
         return method(getattr(self, attr), getattr(other, attr))
 
diff --git a/test/mocking.py b/test/mocking.py
index 192d59c..c2baffb 100644
--- a/test/mocking.py
+++ b/test/mocking.py
@@ -81,7 +81,7 @@ WPi4Fl2qryzTb3QO5r5x7T8OsG2IBUET1bLQzmtbC560SYR49IvVAgMBAAE=
 """
 
 DOC_SIG = stem.descriptor.networkstatus.DocumentSignature(
-  None,
+  "sha1",
   "14C131DFC5C6F93646BE72FA1401C02A8DF2E8B4",
   "BF112F1C6D5543CFD0A32215ACABD4197B5279AD",
   "-----BEGIN SIGNATURE-----%s-----END SIGNATURE-----" % CRYPTO_BLOB)





More information about the tor-commits mailing list