예제 #1
0
    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'
예제 #2
0
    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'
예제 #3
0
    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"