fix the rest of the unit tests

This commit is contained in:
David Stainton 2015-06-29 15:38:07 -07:00 committed by Daira Hopwood
parent 6490bc838b
commit a76d3546bc
2 changed files with 9 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import re
import json import json
from twisted.trial import unittest from twisted.trial import unittest
from twisted.internet import defer
from allmydata.util import fileutil from allmydata.util import fileutil
from allmydata.scripts.common import get_aliases from allmydata.scripts.common import get_aliases
@ -95,10 +96,10 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
return (rc,stdout,stderr) return (rc,stdout,stderr)
d.addCallback(_done) d.addCallback(_done)
def get_alice_caps(x): def get_alice_caps(x):
alice_collective_dircap, alice_upload_dircap = self.get_caps_from_files(0) self.collective_dircap, self.upload_dircap = self.get_caps_from_files(0)
d.addCallback(get_alice_caps) d.addCallback(get_alice_caps)
d.addCallback(lambda x: self.check_joined_config(0, alice_upload_dircap)) d.addCallback(lambda x: self.check_joined_config(0, self.upload_dircap))
d.addCallback(lambda x: self.check_config(1, alice_magic_dir)) d.addCallback(lambda x: self.check_config(0, local_dir))
return d return d
def cleanup(self, res): def cleanup(self, res):

View File

@ -110,7 +110,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
d.addCallback(self._made_upload_dir) d.addCallback(self._made_upload_dir)
d.addCallback(self._create_magicfolder) d.addCallback(self._create_magicfolder)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.dirs_monitored'), 1)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.dirs_monitored'), 1))
d.addBoth(self._cleanup) d.addBoth(self.cleanup)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.dirs_monitored'), 0)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.dirs_monitored'), 0))
return d return d
@ -191,7 +191,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.directories_created'), 2)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.directories_created'), 2))
d.addBoth(self._cleanup) d.addBoth(self.cleanup)
return d return d
def test_persistence(self): def test_persistence(self):
@ -232,11 +232,11 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
d.addCallback(self._create_magicfolder) d.addCallback(self._create_magicfolder)
d.addCallback(lambda x: time.sleep(1)) d.addCallback(lambda x: time.sleep(1))
d.addCallback(self._cleanup) d.addCallback(self.cleanup)
d.addCallback(_restart) d.addCallback(_restart)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_succeeded'), 0)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_succeeded'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0))
d.addBoth(self._cleanup) d.addBoth(self.cleanup)
return d return d
def test_magic_folder(self): def test_magic_folder(self):
@ -271,7 +271,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
# TODO: test that causes an upload failure. # TODO: test that causes an upload failure.
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.files_failed'), 0)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.files_failed'), 0))
d.addBoth(self._cleanup) d.addBoth(self.cleanup)
return d return d
def _check_file(self, name_u, data, temporary=False): def _check_file(self, name_u, data, temporary=False):