def test_modified_files_should_be_marked_as_dirty(self, monkeypatch): monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None) f = GCloudFile(None) f.write(self.TEST_CONTENT) assert f._dirty
def test_large_temporary_files_should_be_rolled_over_to_disk(self, monkeypatch): monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None) f = GCloudFile(None, maxsize=1000) f.write("a".encode("utf8") * 1001) assert f._tmpfile._rolled
def test_modified_files_should_be_marked_as_dirty(self, monkeypatch): monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None) f = GCloudFile(None) f.write(self.TEST_CONTENT) assert f._dirty
def test_large_temporary_files_should_be_rolled_over_to_disk(self, monkeypatch): monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None) f = GCloudFile(None, maxsize=1000) f.write("a".encode("utf8") * 1001) assert f._tmpfile._rolled
def test_should_be_able_to_read_and_write(self, monkeypatch): monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None) f = GCloudFile(None) f.open("w") assert f.read() == (b"" if sys.hexversion >= 0x3000000 else "") f.write(self.TEST_CONTENT) f.seek(0) assert f.read() == self.TEST_CONTENT
def test_should_be_able_to_read_and_write(self, monkeypatch): monkeypatch.setattr(GCloudFile, "_update_blob", lambda: None) f = GCloudFile(None) f.open("w") assert f.read() == (b"" if six.PY3 else "") f.write(self.TEST_CONTENT) f.seek(0) assert f.read() == self.TEST_CONTENT