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

[tor-commits] [ooni-probe/master] Start mocking out the classes for tests



commit 766eecf7b392446bad67ca657d8429eddcad0992
Author: Arturo Filastò <hellais@xxxxxxxxx>
Date:   Wed Apr 11 02:05:51 2012 -0700

    Start mocking out the classes for tests
---
 plugoo/tests.py |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/plugoo/tests.py b/plugoo/tests.py
index 3d6b36b..08d32a8 100644
--- a/plugoo/tests.py
+++ b/plugoo/tests.py
@@ -111,4 +111,52 @@ class Test:
         else:
             self.logger.error("No Assets! Dying!")
 
+class TwistedTest:
+    pass
+
+
+class WorkUnit:
+    pass
+
+class WorkUnitFactory:
+
+    asset_looped = False
+    rules = None
+
+    def __init__(self, rules, assets, nodes):
+        self.rules = rules
+        self.nodes = nodes
+        self.nodes_gen = nodes()
+
+    def next(self):
+        if asset_looped:
+            node = self.nodes()
+        yield WorkUnit(assets, node)
+
+
+class TwistedTestFactory:
+
+    test = TwistedTest
+    assets = None
+
+    def __init__(self, assets, nodes,
+                 rule="*", idx=0):
+        """
+        """
+        self.assets = assets
+        self.nodes = nodes
+        self.rule = rule
+        self.idx = idx
+
+    def process_rules(self):
+
+
+    def build_test(self):
+        """
+        Returns a TwistedTest instance
+        """
+        workunit = self.workunit.next()
+        t = self.test(workunit)
+        t.factory = self
+        return t
 



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