Revision e5a47968 snf-django-lib/snf_django/utils/testing.py

b/snf-django-lib/snf_django/utils/testing.py
149 149
class BaseAPITest(TestCase):
150 150
    def get(self, url, user='user', *args, **kwargs):
151 151
        with astakos_user(user):
152
            response = self.client.get(url, *args, **kwargs)
152
            with mocked_quotaholder():
153
                response = self.client.get(url, *args, **kwargs)
153 154
        return response
154 155

  
155 156
    def delete(self, url, user='user'):
156 157
        with astakos_user(user):
157
            response = self.client.delete(url)
158
            with mocked_quotaholder():
159
                response = self.client.delete(url)
158 160
        return response
159 161

  
160 162
    def post(self, url, user='user', params={}, ctype='json', *args, **kwargs):
161 163
        if ctype == 'json':
162 164
            content_type = 'application/json'
163 165
        with astakos_user(user):
164
            response = self.client.post(url, params, content_type=content_type,
165
                                        *args, **kwargs)
166
            with mocked_quotaholder():
167
                response = self.client.post(url, params,
168
                                            content_type=content_type,
169
                                            *args, **kwargs)
166 170
        return response
167 171

  
168 172
    def put(self, url, user='user', params={}, ctype='json', *args, **kwargs):
169 173
        if ctype == 'json':
170 174
            content_type = 'application/json'
171 175
        with astakos_user(user):
172
            response = self.client.put(url, params, content_type=content_type,
173
                                       *args, **kwargs)
176
            with mocked_quotaholder():
177
                response = self.client.put(url, params,
178
                                           content_type=content_type,
179
                                           *args, **kwargs)
174 180
        return response
175 181

  
176 182
    def assertSuccess(self, response):

Also available in: Unified diff