[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Drop random_fingerprint() helper
commit dfeb747947f5974e7d0fac9e55671685bc84629d
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun May 21 18:32:19 2017 -0700
Drop random_fingerprint() helper
We don't actually need a random fingerprint. Just filling in a value.
---
test/integ/control/base_controller.py | 3 +--
test/integ/control/controller.py | 10 +++++-----
test/integ/socket/control_message.py | 4 +---
test/util.py | 10 ----------
4 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/test/integ/control/base_controller.py b/test/integ/control/base_controller.py
index 4c618e3..9f2fc44 100644
--- a/test/integ/control/base_controller.py
+++ b/test/integ/control/base_controller.py
@@ -12,7 +12,6 @@ import stem.socket
import stem.util.system
import test.require
import test.runner
-import test.util
class StateObserver(object):
@@ -152,7 +151,7 @@ class TestBaseController(unittest.TestCase):
controller.msg('SETEVENTS CONF_CHANGED')
for i in range(10):
- controller.msg('SETCONF NodeFamily=%s' % test.util.random_fingerprint())
+ controller.msg('SETCONF NodeFamily=FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
test.runner.exercise_controller(self, controller)
controller.msg('SETEVENTS')
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 32ce047..2125242 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -27,7 +27,7 @@ from stem.control import EventType, Listener, State
from stem.exit_policy import ExitPolicy
from stem.version import Requirement
-from test.util import register_new_capability, random_fingerprint, tor_version
+from test.util import register_new_capability, tor_version
# Router status entry for a relay with a nickname other than 'Unnamed'. This is
# used for a few tests that need to look up a relay.
@@ -143,7 +143,7 @@ class TestController(unittest.TestCase):
controller.add_event_listener(listener2, EventType.CONF_CHANGED, EventType.DEBUG)
# The NodeFamily is a harmless option we can toggle
- controller.set_conf('NodeFamily', random_fingerprint())
+ controller.set_conf('NodeFamily', 'FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
# Wait for the event. Assert that we get it within 10 seconds
event_notice1.wait(10)
@@ -160,7 +160,7 @@ class TestController(unittest.TestCase):
buffer2_size = len(event_buffer2)
- controller.set_conf('NodeFamily', random_fingerprint())
+ controller.set_conf('NodeFamily', 'FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
event_notice1.wait(10)
self.assertEqual(len(event_buffer1), 2)
event_notice1.clear()
@@ -197,7 +197,7 @@ class TestController(unittest.TestCase):
# trigger an event
- controller.set_conf('NodeFamily', random_fingerprint())
+ controller.set_conf('NodeFamily', 'FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
event_notice.wait(4)
self.assertTrue(len(event_buffer) >= 1)
@@ -210,7 +210,7 @@ class TestController(unittest.TestCase):
controller.connect()
controller.authenticate(password = test.runner.CONTROL_PASSWORD)
self.assertTrue(len(event_buffer) == 0)
- controller.set_conf('NodeFamily', random_fingerprint())
+ controller.set_conf('NodeFamily', 'FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
event_notice.wait(4)
self.assertTrue(len(event_buffer) >= 1)
diff --git a/test/integ/socket/control_message.py b/test/integ/socket/control_message.py
index 6d16f48..6c04464 100644
--- a/test/integ/socket/control_message.py
+++ b/test/integ/socket/control_message.py
@@ -10,8 +10,6 @@ import stem.version
import test.require
import test.runner
-from test.util import random_fingerprint
-
class TestControlMessage(unittest.TestCase):
@test.require.controller
@@ -159,7 +157,7 @@ class TestControlMessage(unittest.TestCase):
# We'll receive both a CONF_CHANGED event and 'OK' response for the
# SETCONF, but not necessarily in any specific order.
- control_socket.send('SETCONF NodeFamily=%s' % random_fingerprint())
+ control_socket.send('SETCONF NodeFamily=FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
msg1 = control_socket.recv()
msg2 = control_socket.recv()
diff --git a/test/util.py b/test/util.py
index adadfe4..56bf975 100644
--- a/test/util.py
+++ b/test/util.py
@@ -13,11 +13,9 @@ Helper functions for our test framework.
get_torrc_entries - provides the torrc entries for a given target
get_all_combinations - provides all combinations of attributes
- random_fingerprint - provides a random relay fingerprint
tor_version - provides the version of tor we're testing against
"""
-import hashlib
import itertools
import os
@@ -239,14 +237,6 @@ def get_all_combinations(attr, include_empty = False):
yield item
-def random_fingerprint():
- """
- Provides a random relay fingerprint.
- """
-
- return hashlib.sha1(os.urandom(20)).hexdigest().upper()
-
-
def tor_version(tor_path = None):
"""
Provides the version of tor we're testing against.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits