From: David Stainton <dstainton415@gmail.com>
Date: Wed, 9 Sep 2015 16:12:10 +0000 (+0200)
Subject: Teach test_persistence to restart client with the new no network grid api changes
X-Git-Url: https://git.rkrishnan.org/simplejson/components/(%5B%5E?a=commitdiff_plain;h=1e136a3ccb517b8cdccf7736f5684de70690d91e;p=tahoe-lafs%2Ftahoe-lafs.git

Teach test_persistence to restart client with the new no network grid api changes
---

diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py
index e22c6615..eb745ade 100644
--- a/src/allmydata/test/test_magic_folder.py
+++ b/src/allmydata/test/test_magic_folder.py
@@ -198,7 +198,6 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         self.set_up_grid()
         self.local_dir = abspath_expanduser_unicode(u"test_persistence", base=self.basedir)
         self.mkdir_nonascii(self.local_dir)
-
         self.collective_dircap = ""
 
         d = self.create_invite_join_magic_folder(u"Alice", self.local_dir)
@@ -213,27 +212,8 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         d.addCallback(create_test_file)
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_succeeded'), 1))
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_queued'), 0))
-
-        def restart(ignore):
-            print "restart"
-            tahoe_config_file = os.path.join(self.get_clientdir(), "tahoe.cfg")
-            tahoe_config = fileutil.read(tahoe_config_file)
-            print tahoe_config
-            self.failUnlessIn("[magic_folder]\nenabled = True", tahoe_config)
-            d3 = defer.succeed(None)
-            def write_config(client_node_dir):
-                print "write_config"
-                fileutil.write(os.path.join(client_node_dir, "tahoe.cfg"), tahoe_config)
-            def setup_stats(result):
-                #print "setup_stats"
-                self.set_up_grid(client_config_hooks={0: write_config})
-                self.magicfolder = self.get_client().getServiceNamed("magic-folder")
-
-            d3.addBoth(self.cleanup)
-            d3.addCallback(setup_stats)
-            #d3.addCallback(self._create_magicfolder)
-            return d3
-        d.addCallback(restart)
+        d.addCallback(self.cleanup)
+        d.addCallback(self._restart_client)
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_succeeded'), 0))
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_queued'), 0))
         d.addBoth(self.cleanup)