[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 4f108d1dffd2e23db8ced6d4cb755a336a0767f3
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits