Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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