cubicweb/ext/test/unittest_rest.py
changeset 12567 26744ad37953
parent 12489 79fce4bde06f
equal deleted inserted replaced
12566:6b3523f81f42 12567:26744ad37953
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    14 # details.
    14 # details.
    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 from six import PY3
       
    19 
    18 
    20 from logilab.common.testlib import unittest_main
    19 from logilab.common.testlib import unittest_main
    21 from cubicweb.devtools.testlib import CubicWebTC
    20 from cubicweb.devtools.testlib import CubicWebTC
    22 
    21 
    23 from cubicweb.ext.rest import rest_publish
    22 from cubicweb.ext.rest import rest_publish
    91     def test_rql_role_with_unknown_vid(self):
    90     def test_rql_role_with_unknown_vid(self):
    92         with self.admin_access.web_request() as req:
    91         with self.admin_access.web_request() as req:
    93             context = self.context(req)
    92             context = self.context(req)
    94             out = rest_publish(context, ':rql:`Any X WHERE X is CWUser:toto`')
    93             out = rest_publish(context, ':rql:`Any X WHERE X is CWUser:toto`')
    95             self.assertTrue(out.startswith("<p>an error occurred while interpreting this "
    94             self.assertTrue(out.startswith("<p>an error occurred while interpreting this "
    96                                            "rql directive: ObjectNotFound(%s'toto'" %
    95                                            "rql directive: ObjectNotFound('toto'"),
    97                                            ('' if PY3 else 'u')),
       
    98                             out)
    96                             out)
    99 
    97 
   100     def test_rql_role_without_vid(self):
    98     def test_rql_role_without_vid(self):
   101         with self.admin_access.web_request() as req:
    99         with self.admin_access.web_request() as req:
   102             context = self.context(req)
   100             context = self.context(req)