equal
deleted
inserted
replaced
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """unit tests for module cubicweb.server.sources.storages""" |
18 """unit tests for module cubicweb.server.sources.storages""" |
19 |
19 |
20 from six import PY2 |
|
21 |
|
22 from logilab.common.testlib import unittest_main, tag, Tags |
20 from logilab.common.testlib import unittest_main, tag, Tags |
23 from cubicweb.devtools.testlib import CubicWebTC |
21 from cubicweb.devtools.testlib import CubicWebTC |
24 |
22 |
25 from glob import glob |
23 from glob import glob |
26 import os |
24 import os |
77 data_name=u'foo.pdf') |
75 data_name=u'foo.pdf') |
78 |
76 |
79 def fspath(self, cnx, entity): |
77 def fspath(self, cnx, entity): |
80 fspath = cnx.execute('Any fspath(D) WHERE F eid %(f)s, F data D', |
78 fspath = cnx.execute('Any fspath(D) WHERE F eid %(f)s, F data D', |
81 {'f': entity.eid})[0][0].getvalue() |
79 {'f': entity.eid})[0][0].getvalue() |
82 return fspath if PY2 else fspath.decode('utf-8') |
80 return fspath.decode('utf-8') |
83 |
81 |
84 def test_bfss_wrong_fspath_usage(self): |
82 def test_bfss_wrong_fspath_usage(self): |
85 with self.admin_access.repo_cnx() as cnx: |
83 with self.admin_access.repo_cnx() as cnx: |
86 f1 = self.create_file(cnx) |
84 f1 = self.create_file(cnx) |
87 cnx.execute('Any fspath(D) WHERE F eid %(f)s, F data D', {'f': f1.eid}) |
85 cnx.execute('Any fspath(D) WHERE F eid %(f)s, F data D', {'f': f1.eid}) |