def test_replace(self, db_session): file_id = self.make_one() DBFileStorage().replace(file_id, 'second content', u'f2.jpg', 'doc') fs = DBFileStorage().get(file_id) assert fs.filename == u'f2.jpg' assert fs.content_type == 'doc' assert fs.read() == 'second content' DBFileStorage().replace(fs, 'third content', u'f3.jpg', 'xls') assert fs.filename == u'f3.jpg' assert fs.content_type == 'xls' assert fs.read() == 'third content'
def test_replace(self, db_session): file_id = self.make_one() DBFileStorage().replace(file_id, 'second content', u'f2.jpg', 'doc') fs = DBFileStorage().get(file_id) assert fs.filename == u'f2.jpg' assert fs.content_type == 'doc' assert fs.read() == 'second content' DBFileStorage().replace(fs, 'third content', u'f3.jpg', 'xls') assert fs.filename == u'f3.jpg' assert fs.content_type == 'xls' assert fs.read() == 'third content'
def test_replace(self, db_session): file_id = self.make_one() DBFileStorage().replace(file_id, b"second content", "f2.jpg", "doc") fs = DBFileStorage().get(file_id) assert fs.filename == "f2.jpg" assert fs.content_type == "doc" assert fs.read() == b"second content" DBFileStorage().replace(fs, b"third content", "f3.jpg", "xls") assert fs.filename == "f3.jpg" assert fs.content_type == "xls" assert fs.read() == b"third content"