Exemplo n.º 1
0
    def session(self):
        session = self._session.get()
        auth = add_bearer(self.token)
        if session.headers.get(HttpHeaderKeys.Authorization) != auth:
            session.headers[HttpHeaderKeys.Authorization] = auth

        return session
Exemplo n.º 2
0
    def session(self):
        session = self._session.get()
        auth = add_bearer(self.token)
        if session.headers.get("Authorization") != auth:
            session.headers["Authorization"] = auth

        return session
Exemplo n.º 3
0
    def session(self):
        """Session: The session instance used by this service."""
        session = self._session.get()
        auth = add_bearer(self.token)
        if session.headers.get(HttpHeaderKeys.Authorization) != auth:
            session.headers[HttpHeaderKeys.Authorization] = auth

        return session
Exemplo n.º 4
0
 def test_session_token(self):
     service = JsonApiService("foo", auth=mock.MagicMock(token=FAKE_TOKEN))
     assert service.session.headers.get("Authorization") == add_bearer(
         FAKE_TOKEN)