Revision 698016f7 snf-astakos-app/astakos/oa2/tests/djangobackend.py

b/snf-astakos-app/astakos/oa2/tests/djangobackend.py
377 377
        self.assertEqual(code4.state, 'csrfstate')
378 378
        self.assertEqual(code4.redirect_uri, self.client3_redirect_uri)
379 379

  
380
        params['redirect_uri'] = '%s/more' % self.client3_redirect_uri
381
        self.client.set_credentials('client3', 'secret')
382
        r = self.client.authorize_code('client3', urlparams=params)
383
        self.assertEqual(r.status_code, 302)
384
        self.assertCount(AuthorizationCode, 5)
385

  
386
        # redirect is valid
387
        redirect5 = self.get_redirect_url(r)
388
        self.assertParam(redirect5, "code")
389
        self.assertParamEqual(redirect5, "state", 'csrfstate')
390
        self.assertNoParam(redirect5, "extra_param")
391
        self.assertHost(redirect5, "server3.com")
392
        self.assertPath(redirect5, "/handle_code/more")
393

  
394
        code4 = AuthorizationCode.objects.get(code=redirect5.params['code'][0])
395
        self.assertEqual(code4.state, 'csrfstate')
396
        self.assertEqual(code4.redirect_uri,
397
                         '%s/more' % self.client3_redirect_uri)
398

  
380 399
    def test_get_token(self):
381 400
        # invalid method
382 401
        r = self.client.get(self.client.token_url)

Also available in: Unified diff