def test_body(self): data = json.dumps({'key': 'value'}) post = RequestFactory().post('/', data, content_type='application/json') post.META[settings.HEADER_DESTINATION] = '/some/url/' eq_(utils.prepare(post)['data'], data)
def test_header_ignored(self): assert 'Foo' not in settings.HEADERS_ALLOWED self.req.META['HTTP_FOO'] = 'bar' res = utils.prepare(self.req) ok_('Foo' not in res['headers'])
def test_header_added(self): self.req.META['HTTP_X_SOLITUDE_SOAPACTION'] = 'something' res = utils.prepare(self.req) eq_(res['headers']['SOAPAction'], 'something')
def test_url_ok(self): res = utils.prepare(self.req) eq_(res['url'], '/some/url/')
def test_no_header(self): utils.prepare(RequestFactory().get('/'))
def test_url(): req = RequestFactory().get( '/v1/reference/reference/bar?q=1', **{settings.HEADER_DESTINATION: 'http://foo.com'}) eq_(utils.reference_url(req, utils.prepare(req), 'reference'), 'http://foo.com/bar?q=1')