|
|
|
|
1
|
# -*- coding: utf-8 -*-
|
1
|
# -*- coding: utf-8 -*-
|
2
|
import time
|
2
|
import time
|
3
|
|
3
|
|
|
|
4
|
+from depot.fields.upload import UploadedFile
|
4
|
from nose.tools import ok_
|
5
|
from nose.tools import ok_
|
5
|
from nose.tools import raises
|
6
|
from nose.tools import raises
|
6
|
from sqlalchemy.sql.elements import and_
|
7
|
from sqlalchemy.sql.elements import and_
|
7
|
from sqlalchemy.testing import eq_
|
8
|
from sqlalchemy.testing import eq_
|
8
|
-from depot.fields.upload import UploadedFile
|
|
|
9
|
|
9
|
|
10
|
from tracim.lib.content import ContentApi
|
10
|
from tracim.lib.content import ContentApi
|
11
|
from tracim.lib.exception import ContentRevisionUpdateError
|
11
|
from tracim.lib.exception import ContentRevisionUpdateError
|
|
|
|
|
204
|
# tests uninitialized depot file
|
204
|
# tests uninitialized depot file
|
205
|
eq_(content.depot_file, None)
|
205
|
eq_(content.depot_file, None)
|
206
|
# initializes depot file
|
206
|
# initializes depot file
|
|
|
207
|
+ # which is able to behave like a python file object
|
207
|
content.depot_file = b'test'
|
208
|
content.depot_file = b'test'
|
208
|
# tests initialized depot file
|
209
|
# tests initialized depot file
|
209
|
ok_(content.depot_file)
|
210
|
ok_(content.depot_file)
|
210
|
# tests type of initialized depot file
|
211
|
# tests type of initialized depot file
|
211
|
eq_(type(content.depot_file), UploadedFile)
|
212
|
eq_(type(content.depot_file), UploadedFile)
|
212
|
# tests content of initialized depot file
|
213
|
# tests content of initialized depot file
|
|
|
214
|
+ # using depot_file.file of type StoredFile to fetch content back
|
213
|
eq_(content.depot_file.file.read(), b'test')
|
215
|
eq_(content.depot_file.file.read(), b'test')
|