Exemplo n.º 1
0
    def _get_client(self, credentials):
        if not self._client:
            partial = mendeley.Mendeley(
                client_id=self.client_id,
                client_secret=self.client_secret,
                redirect_uri=web_url_for('oauth_callback',
                                         service_name='mendeley',
                                         _absolute=True),
            )
            self._client = APISession(partial, credentials)

        return self._client
Exemplo n.º 2
0
 def _get_client(self, credentials=None):
     partial = mendeley.Mendeley(
         client_id=self.client_id,
         client_secret=self.client_secret,
         redirect_uri=web_url_for('oauth_callback',
                                  service_name='mendeley',
                                  _absolute=True),
     )
     credentials = credentials or {
         'access_token': self.account.oauth_key,
         'refresh_token': self.account.refresh_token,
         'expires_at': time.mktime(self.account.expires_at.timetuple()),
         'token_type': 'bearer',
     }
     return APISession(partial, credentials)
Exemplo n.º 3
0
 def test_request_params(self, mock_request):
     # All GET requests to Mendeley should have the param "view=all"
     client = APISession(self.mock_partial, self.mock_credentials)
     client.request()
     args, kwargs = mock_request.call_args
     assert_equal(kwargs['params'], {'view': 'all', 'limit': '500'})
Exemplo n.º 4
0
 def test_request_params(self, mock_request):
     # All GET requests to Mendeley should have the param "view=all"
     client = APISession(self.mock_partial, self.mock_credentials)
     client.request()
     args, kwargs = mock_request.call_args
     assert_equal(kwargs['params'], {'view': 'all'})