def logged_out(monkeypatch): mock_load = Mock() mock_load.side_effect = fair_research_login.LoadError() monkeypatch.setattr(fair_research_login.NativeClient, 'load_tokens', mock_load) monkeypatch.setattr(MinidClient, 'is_logged_in', Mock(return_value=False)) return mock_load
def test_is_logged_in(monkeypatch): mc = MinidClient() monkeypatch.setattr(mc.native_client, 'get_authorizers_by_scope', Mock(side_effect=fair_research_login.LoadError())) mc._authorizer = None assert mc.is_logged_in() is False mc._authorizer = Mock() assert mc.is_logged_in() is True
def logged_out(monkeypatch): load = Mock(side_effect=fair_research_login.LoadError()) monkeypatch.setattr(fair_research_login.NativeClient, "load_tokens_by_scope", load) return fair_research_login.NativeClient