[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Move Director Mocks into mocks.py
commit 4ffc3c0fefe2f902a48b25df74920e8f46a4486d
Author: aagbsn <aagbsn@xxxxxxxx>
Date: Tue Jan 15 12:37:34 2013 +0000
Move Director Mocks into mocks.py
---
tests/mocks.py | 6 ++++++
tests/test_director.py | 14 +-------------
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/tests/mocks.py b/tests/mocks.py
index 60727e5..fa57927 100644
--- a/tests/mocks.py
+++ b/tests/mocks.py
@@ -25,9 +25,15 @@ class MockMeasurementManager(TaskManager):
self.successes.append((result, task))
class MockReporter(object):
+ def __init__(self):
+ self.created = defer.succeed(None)
+
def write(self, measurement):
pass
+ def createReport(self):
+ pass
+
## from test_managers
mockFailure = failure.Failure(Exception('mock'))
diff --git a/tests/test_director.py b/tests/test_director.py
index 0721a2d..409047b 100644
--- a/tests/test_director.py
+++ b/tests/test_director.py
@@ -2,10 +2,8 @@ from twisted.internet import defer, base
from twisted.trial import unittest
from ooni.director import Director
+from tests.mocks import MockReporter
base.DelayedCall.debug = True
-class MockMeasurement(object):
- def run(self):
- return defer.succeed(42)
net_test_string = """
from twisted.python import usage
@@ -29,16 +27,6 @@ class DummyTestCase(NetTestCase):
dummyOptions = {'spam': 1, 'file': 'dummyInputFile.txt'}
-class MockReporter(object):
- def __init__(self):
- self.created = defer.succeed(None)
-
- def createReport(self):
- pass
-
- def write(self):
- pass
-
class TestDirector(unittest.TestCase):
timeout = 1
def setUp(self):
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits