for i in localURIs: f = File.File(i,implName=impl) ok("Local: %s exists" % i, f.exists()) remote = f.is_local() == 1 # these might not be local, we might be on nfs after all! ok("Local: is local = %s" % remote,remote,die=False) mime = f.get_mimetype() ok("Local: file mimetype = %s" % mime,type(mime) == str and len(mime) > 0) mtime = f.get_mtime() ok("Local: file mtime = %s" % mtime,mtime != None) size = f.get_size() #the files are 5 bytes in size ok("Local: file size = %s" % size,size == 5) fname = f.get_filename() #Not a strict test because my get_filename() is a bit of a hack ok("Local: file name = %s" % fname,fname == Vfs.uri_get_filename(i)) comp = oldest.compare(older) ok("Local Compare: checking oldest < older = %s" % comp,comp == conduit.datatypes.COMPARISON_OLDER) comp = newest.compare(newer) ok("Local Compare: checking newest > newer = %s" % comp,comp == conduit.datatypes.COMPARISON_NEWER) comp = newest.compare(newest) ok("Local Compare: checking newest == newest = %s" % comp,comp == conduit.datatypes.COMPARISON_EQUAL) comp = oldest.compare(null) ok("Local Compare: checking oldest w null = %s" % comp,comp == conduit.datatypes.COMPARISON_NEWER) #test the handling of weird characters and transferring files to unusual paths tmpdir = Utils.new_tempdir() f1 = Utils.new_tempfile(Utils.random_string(), implName=impl) f2 = os.path.join(tmpdir,"I am", "a", "path with spaces", "foo.txt")
def get_name(self): return Vfs.uri_get_filename(self.folder)