def _process_get(ctx, resource, request): try: content_dict = process_get_request( ctx, resource, request.GET ) return _content_success(ctx, resource, request, content_dict) except MethodNotAllowedError: return _not_allowed_method(ctx, resource, request)
def _get_request_for_batch(ctx, resource, data): resource_result = {} get_data = MultiValueDict() get_data.update(data) content_dict = process_get_request(ctx, resource, get_data) resource_result['status'] = 200 resource_result['etag'] = get_sha1(ctx, content_dict) resource_result['data'] = content_dict return resource_result
def _process_get(ctx, resource, request): try: content_dict = process_get_request(ctx, resource, request.GET) return _content_success(ctx, resource, request, content_dict) except MethodNotAllowedError: return _not_allowed_method(ctx, resource, request)
def test_get_not_allowed(self): with self.assertRaises(MethodNotAllowedError): resource = Mock(name='resource', allowed_methods=['POST']) helpers.process_get_request(Mock(name='ctx'), resource, {})
def test_get(self, ParamsImplClass): ParamsImplClass.return_value = 'getparams' resource = Mock(name='resource', allowed_methods=['GET']) ctx = Mock(name='ctx') helpers.process_get_request(ctx, resource, {}) resource.get.assert_called_with(ctx, 'getparams')