def box_session(): mock_oauth = Mock(OAuth2) mock_oauth.access_token = 'fake_access_token' mock_network_layer = Mock(DefaultNetwork) return BoxSession(mock_oauth, mock_network_layer)
def mock_box_session_2(): mock_session = MagicMock(BoxSession) # pylint:disable=protected-access mock_session._api_config = API() mock_session._client_config = Client() # pylint:enable=protected-access mock_session.get_url.side_effect = lambda *args, **kwargs: BoxSession.get_url( mock_session, *args, **kwargs) return mock_session
def box_session(box_oauth, network_layer): # pylint:disable=redefined-outer-name return BoxSession(oauth=box_oauth, network_layer=network_layer)
def mock_box_session_2(): mock_session = MagicMock(BoxSession) mock_session.get_url.side_effect = lambda *args, **kwargs: BoxSession.get_url(mock_session, *args, **kwargs) return mock_session
def mock_box_session(translator): mock_session = MagicMock(BoxSession) mock_session.get_url.side_effect = lambda *args, **kwargs: BoxSession.get_url(mock_session, *args, **kwargs) mock_session.translator = translator return mock_session
def box_session(mock_oauth, mock_network_layer, translator): # pylint:disable=redefined-outer-name return BoxSession(oauth=mock_oauth, network_layer=mock_network_layer, translator=translator)