From 44b4dbdb97c20a00ab497de323ae3d7cc6a4db34 Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Tue, 8 Sep 2015 15:26:15 +0100
Subject: [PATCH] Cleanup of _restart_client.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 src/allmydata/test/test_magic_folder.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py
index 7c21a087..4d4a0962 100644
--- a/src/allmydata/test/test_magic_folder.py
+++ b/src/allmydata/test/test_magic_folder.py
@@ -46,13 +46,14 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
     def _restart_client(self, ign):
         print "_restart_client"
         d = self.restart_client()
-        def _restarted(ign):
-            print "_restarted"
-            self.magicfolder = self.get_client().getServiceNamed('magic-folder')
-            return self.magicfolder.uploader.started_d
-        d.addCallback(_restarted)
+        d.addCallback(self._wait_until_started)
         return d
 
+    def _wait_until_started(self, ign):
+        print "_wait_until_started"
+        self.magicfolder = self.get_client().getServiceNamed('magic-folder')
+        return self.magicfolder.uploader.started_d
+
     def _create_magicfolder(self, ign):
         dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.basedir)
         self.magicfolder = MagicFolder(self.get_client(), self.upload_dircap, self.collective_dircap, self.local_dir,
-- 
2.45.2