return d
def start_scanning(self):
+ print "start_scanning self._db = %r" % (self._db,)
self.is_ready = True
+ all_files = self._db.get_all_files()
+ print "ALL files recorded in magic-folder db: %s" % (all_files,)
d = self._scan(self._local_path_u) # XXX do not want dropped deferreds!
self._turn_deque()
return d
return upload_d
elif pathinfo.isfile:
version = self._db.get_local_file_version(relpath_u)
+ print "LOCAL version %s" % (version,)
if version is None:
version = 0
else:
d = self.create_invite_join_magic_folder(u"Alice", self.local_dir)
d.addCallback(self._create_magicfolder)
- def create_test_file(result):
+ def create_test_file(result, filename):
d2 = self.magicfolder.uploader.set_hook('processed')
- test_file = abspath_expanduser_unicode(u"what", base=self.local_dir)
+ test_file = abspath_expanduser_unicode(filename, base=self.local_dir)
fileutil.write(test_file, "meow")
self.notify(to_filepath(test_file), self.inotify.IN_CLOSE_WRITE)
return d2
- d.addCallback(create_test_file)
+ d.addCallback(lambda ign: create_test_file(ign, u"what1"))
+ def fu(ign):
+ print "upload complete"
+ d.addBoth(fu)
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))
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: create_test_file(ign, u"what2"))
+
+ def fu2(ign):
+ print "2nd upload complete"
+ d.addBoth(fu2)
+
+ 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))
d.addBoth(self.cleanup)
return d