Beispiel #1
0
 def test_it(self):
     src = pjoin(self.dir, "copy_test_src")
     dest = pjoin(self.dir, "copy_test_dest")
     open(src, "w").writelines("asdf\n" for i in xrange(10))
     kwds = {"mtime":10321, "uid":os.getuid(), "gid":os.getgid(),
             "mode":0664, "data":local_source(src), "dev":None,
             "inode":None}
     o = fs.fsFile(dest, **kwds)
     self.assertTrue(ops.default_copyfile(o))
     self.assertEqual("asdf\n" * 10, open(dest, "r").read())
     self.verify(o, kwds, os.stat(o.location))
Beispiel #2
0
 def test_sym_perms(self):
     curgid = os.getgid()
     group = [x for x in os.getgroups() if x != curgid]
     if not group and os.getuid() != 0:
         raise SkipTest("requires root privs for this test, or for this"
             " user to belong to more then one group")
     group = group[0]
     fp = pjoin(self.dir, "sym")
     o = fs.fsSymlink(fp, mtime=10321, uid=os.getuid(), gid=group,
         mode=0664, target='target')
     self.assertTrue(ops.default_copyfile(o))
     self.assertEqual(os.lstat(fp).st_gid, group)
     self.assertEqual(os.lstat(fp).st_uid, os.getuid())
Beispiel #3
0
 def test_it(self):
     src = pjoin(self.dir, "copy_test_src")
     dest = pjoin(self.dir, "copy_test_dest")
     with open(src, "w") as f:
         f.writelines("asdf\n" for i in xrange(10))
     kwds = {"mtime":10321, "uid":os.getuid(), "gid":os.getgid(),
             "mode":0664, "data":local_source(src), "dev":None,
             "inode":None}
     o = fs.fsFile(dest, **kwds)
     self.assertTrue(ops.default_copyfile(o))
     with open(dest, "r") as f:
         self.assertEqual("asdf\n" * 10, f.read())
     self.verify(o, kwds, os.stat(o.location))