def _dummy_GET_request(self, params={}):
     # Mangle the params dict into a query string
     qs = "&".join(["=".join([k, str(params[k])]) for k in params])
     environ = {'REQUEST_METHOD': 'GET', 'QUERY_STRING': qs}
     req = Request(environ)
     req.context = utils.dummy_context()
     return req
Example #2
0
 def _dummy_GET_request(self, params={}):
     # Mangle the params dict into a query string
     qs = "&".join(["=".join([k, str(params[k])]) for k in params])
     environ = {"REQUEST_METHOD": "GET", "QUERY_STRING": qs}
     req = Request(environ)
     req.context = self._create_context()
     return req
Example #3
0
 def _dummy_GET_request(self, params={}):
     # Mangle the params dict into a query string
     qs = "&".join(["=".join([k, str(params[k])]) for k in params])
     environ = {'REQUEST_METHOD': 'GET', 'QUERY_STRING': qs}
     req = Request(environ)
     req.context = self._create_context()
     return req
Example #4
0
    def _simple_request(self, path, method='GET'):
        environ = self._environ(path)
        environ['REQUEST_METHOD'] = method

        req = Request(environ)
        req.context = self._create_context()
        return req
Example #5
0
    def _simple_request(self, path, method='GET'):
        environ = self._environ(path)
        environ['REQUEST_METHOD'] = method

        req = Request(environ)
        req.context = self._create_context()
        return req
Example #6
0
    def _data_request(self, path, data, content_type="application/json", method="POST"):
        environ = self._environ(path)
        environ["REQUEST_METHOD"] = method

        req = Request(environ)
        req.context = self._create_context()
        req.body = data
        return req
Example #7
0
    def _data_request(self, path, data, content_type='application/json',
                      method='POST'):
        environ = self._environ(path)
        environ['REQUEST_METHOD'] = method

        req = Request(environ)
        req.context = self._create_context()
        req.body = data
        return req
Example #8
0
    def _data_request(self,
                      path,
                      data,
                      content_type='application/json',
                      method='POST'):
        environ = self._environ(path)
        environ['REQUEST_METHOD'] = method

        req = Request(environ)
        req.context = self._create_context()
        req.body = data
        return req
Example #9
0
 def _dummy_GET_request(self, params=None, environ=None):
     # Mangle the params dict into a query string
     params = params or {}
     environ = environ or {}
     qs = "&".join(["=".join([k, str(params[k])]) for k in params])
     environ.update({'REQUEST_METHOD': 'GET', 'QUERY_STRING': qs})
     req = Request(environ)
     return req
    def setUp(self):
        super(TestPolicyEnforce, self).setUp()
        self.req = Request({})
        self.req.context = context.RequestContext(tenant_id='foo',
                                                  is_admin=False)

        class DummyController(object):
            REQUEST_SCOPE = 'test'

            @util.policy_enforce
            def an_action(self, req):
                return 'woot'

        self.controller = DummyController()
 def setUp(self):
     super(TestGetAllowedParams, self).setUp()
     req = Request({})
     self.params = req.params.copy()
     self.params.add('foo', 'foo value')
     self.whitelist = {'foo': 'single'}
Example #12
0
 def setUp(self):
     super(TestTenantLocal, self).setUp()
     self.req = Request({})
     self.req.context = context.RequestContext(tenant_id='foo')