Beispiel #1
0
 def test_respects_writable_mode_of_files(self, fs):
     fs = MemoryFS()
     write_file(fs, "file", u"foo")
     fs.chmod("file", stat.S_IRUSR)
     assert_file_content_equal(fs, "file", u"foo")
     assert_open_raises(fs, "file", errno.EACCES, "a")
     assert_open_raises(fs, "file", errno.EACCES, "w")
Beispiel #2
0
    def test_writing_original_files_keeps_stored_file_unchanged(self, fs):
        write_file(fs, 'testfile', u'dummy content')

        cas = ContentAddressableStorage('cas', fs=fs)
        key = cas.store('testfile')
        del cas  # Close

        write_file(fs, 'testfile', u'replaced content')
        cas = ContentAddressableStorage('cas', fs=fs)
        assert_file_content_equal(fs, cas.get_path(key), u'dummy content')
Beispiel #3
0
 def test_symlink(self, fs):
     fs.mkdir("sub1")
     fs.mkdir("sub2")
     src = os.path.join("sub1", "src")
     dest = os.path.join("sub2", "dest")
     write_file(fs, src, u"dummy")
     fs.symlink(src, dest)
     with fs.open(dest, "a+") as f:
         f.seek(0, os.SEEK_SET)
         assert f.read() == u"dummy"
         f.write(u" content")
     assert_file_content_equal(fs, src, u"dummy content")