# TODO: allow a path rather than a cap URI.
self._upload_dirnode = self._client.create_node_from_uri(upload_dircap)
- if collective_dircap != "":
- # XXX this condition used for some unit tests
- self._collective_dirnode = self._client.create_node_from_uri(collective_dircap)
- if not IDirectoryNode.providedBy(self._collective_dirnode):
- raise AssertionError("The URI in 'private/collective_dircap' does not refer to a directory.")
- if self._collective_dirnode.is_unknown() or not self._collective_dirnode.is_readonly():
- raise AssertionError("The URI in 'private/collective_dircap' is not a readonly cap to a directory.")
+
+ self._collective_dirnode = self._client.create_node_from_uri(collective_dircap)
+ if not IDirectoryNode.providedBy(self._collective_dirnode):
+ raise AssertionError("The URI in 'private/collective_dircap' does not refer to a directory.")
+ if self._collective_dirnode.is_unknown() or not self._collective_dirnode.is_readonly():
+ raise AssertionError("The URI in 'private/collective_dircap' is not a readonly cap to a directory.")
if not IDirectoryNode.providedBy(self._upload_dirnode):
raise AssertionError("The URI in 'private/magic_folder_dircap' does not refer to a directory.")
d.addCallback(_done)
def get_alice_caps(x):
self.collective_dircap, self.upload_dircap = self.get_caps_from_files(0)
+ self.collective_dirnode = self.client.create_node_from_uri(self.collective_dircap)
+ self.upload_dirnode = self.client.create_node_from_uri(self.upload_dircap)
d.addCallback(get_alice_caps)
d.addCallback(lambda x: self.check_joined_config(0, self.upload_dircap))
d.addCallback(lambda x: self.check_config(0, local_dir))
temp = self.mktemp()
self.basedir = abspath_expanduser_unicode(temp.decode(get_filesystem_encoding()))
self.magicfolder = None
- self.dir_node = None
def _get_count(self, name):
return self.stats_provider.get_stats()["counters"].get(name, 0)
self.failUnlessEqual(bdb.VERSION, 3)
return bdb
- def _made_upload_dir(self, n):
- if self.dir_node == None:
- self.dir_node = n
- else:
- n = self.dir_node
- self.failUnless(IDirectoryNode.providedBy(n))
- self.upload_dirnode = n
- self.upload_dircap = n.get_uri()
- self.collective_dircap = ""
-
def _create_magicfolder(self, ign):
dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.basedir)
self.magicfolder = MagicFolder(self.client, self.upload_dircap, self.collective_dircap, self.local_dir,
self.client = self.g.clients[0]
self.stats_provider = self.client.stats_provider
- d = self.client.create_dirnode()
- d.addCallback(self._made_upload_dir)
+ d = self.create_invite_join_magic_folder(u"Alice", self.local_dir)
d.addCallback(self._create_magicfolder)
+
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.dirs_monitored'), 1))
d.addBoth(self.cleanup)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.dirs_monitored'), 0))
d = self.create_invite_join_magic_folder(u"Alice", self.local_dir)
d.addCallback(self._create_magicfolder)
+
def create_test_file(result):
d2 = defer.Deferred()
self.magicfolder.set_processed_callback(d2.callback, ignore_count=0)
self.client = self.g.clients[0]
self.stats_provider = self.client.stats_provider
- d = self.client.create_dirnode()
-
- d.addCallback(self._made_upload_dir)
- self.collective_dircap = ""
+ d = self.create_invite_join_magic_folder(u"Alice", self.local_dir)
d.addCallback(self._create_magicfolder)
# Write something short enough for a LIT file.