コード例 #1
0
 def test_request_with_token_authentication(self, request):
     request.return_value.json.return_value = self.token_response
     c = Client(**self.data)
     c.request('GET', '/clients', token=True)
     auth = ('client', 'secret')
     request.assert_called_with(
         'GET', 'http://localhost:4444/clients', auth=auth)
コード例 #2
0
 def test_request_with_basic_authentication(self, request):
     c = Client(**self.data)
     c.request(
         'POST', '/oauth2/token', token=False,
         auth=('client', 'secret'), json={'token': 'foobar'})
     request.assert_called_with(
         'POST', 'http://localhost:4445/oauth2/token',
         auth=('client', 'secret'), json={'token': 'foobar'})
コード例 #3
0
ファイル: test_oauth2.py プロジェクト: weima/python-hydra-sdk
 def test_request_with_token_authentication(self, request):
     request.return_value.json.return_value = self.token_response
     c = Client(**self.data)
     c.request('GET', '/clients', token=True)
     headers = {'Authorization': 'bearer super-token'}
     request.assert_called_with('GET',
                                'http://localhost/clients',
                                headers=headers)