]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Teach magic-folder test helpers to use passed in clock
authorDavid Stainton <dstainton415@gmail.com>
Thu, 17 Sep 2015 07:26:00 +0000 (09:26 +0200)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 30 Sep 2015 15:45:27 +0000 (16:45 +0100)
src/allmydata/test/test_cli_magic_folder.py

index bdb23160105a900f657d42bddb4a8991e1e75f93..1ba831ac3ba83901e64ce864bf973d86e7a5c46e 100644 (file)
@@ -3,6 +3,7 @@ import re
 
 from twisted.trial import unittest
 from twisted.internet import defer
+from twisted.internet import reactor
 
 from allmydata.util import fileutil
 from allmydata.scripts.common import get_aliases
@@ -100,15 +101,15 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
         d.addCallback(lambda ign: res)
         return d
 
-    def init_magicfolder(self, client_num, upload_dircap, collective_dircap, local_magic_dir):
+    def init_magicfolder(self, client_num, upload_dircap, collective_dircap, local_magic_dir, clock):
         dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.get_clientdir(i=client_num))
         magicfolder = MagicFolder(self.get_client(client_num), upload_dircap, collective_dircap, local_magic_dir,
-                                       dbfile, pending_delay=0.2)
+                                       dbfile, pending_delay=0.2, clock=clock)
         magicfolder.setServiceParent(self.get_client(client_num))
         magicfolder.ready()
         return magicfolder
 
-    def setup_alice_and_bob(self):
+    def setup_alice_and_bob(self, clock=reactor):
         self.set_up_grid(num_clients=2)
 
         alice_magic_dir = abspath_expanduser_unicode(u"Alice-magic", base=self.basedir)
@@ -130,7 +131,7 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
         d.addCallback(lambda x: self.check_joined_config(0, self.alice_upload_dircap))
         d.addCallback(lambda x: self.check_config(0, alice_magic_dir))
         def get_Alice_magicfolder(result):
-            self.alice_magicfolder = self.init_magicfolder(0, self.alice_upload_dircap, self.alice_collective_dircap, alice_magic_dir)
+            self.alice_magicfolder = self.init_magicfolder(0, self.alice_upload_dircap, self.alice_collective_dircap, alice_magic_dir, clock)
             return result
         d.addCallback(get_Alice_magicfolder)
 
@@ -146,7 +147,7 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
         d.addCallback(lambda x: self.check_joined_config(1, self.bob_upload_dircap))
         d.addCallback(lambda x: self.check_config(1, bob_magic_dir))
         def get_Bob_magicfolder(result):
-            self.bob_magicfolder = self.init_magicfolder(1, self.bob_upload_dircap, self.bob_collective_dircap, bob_magic_dir)
+            self.bob_magicfolder = self.init_magicfolder(1, self.bob_upload_dircap, self.bob_collective_dircap, bob_magic_dir, clock)
             return result
         d.addCallback(get_Bob_magicfolder)