def test_get_invalid_uri_name(self): try: invalid_uri_name = 'invalid-uri-name' uri = uri_for(invalid_uri_name) self.fail("Got uri '%s' for invalid uri name '%s'" % (uri, invalid_uri_name)) except Exception, e: self.assertEqual(e.message, "Route named '%s' is not defined." % invalid_uri_name)
def render(self, context): args = [arg.resolve(context) for arg in self.args] kwargs = dict([(str(k), v.resolve(context)) for k, v in self.kwargs.items()]) url = None try: from agar.url import uri_for url = uri_for(self.route_name, *args, **kwargs) except Exception, e: if self.asvar is None: raise e
def setUp(self): WSGIApplication.request = Request.blank("/") self.uri = uri_for('api-v1') super(FormTest, self).setUp()