def test_oauth1session_should_load_token(): responses.add(responses.GET, "https://example.com/test") bp = mock.Mock(token=None) sess = OAuth1Session(client_key="ckey", client_secret="csec", blueprint=bp) sess.load_token = mock.Mock(wraps=sess.load_token) sess.get("https://example.com/test", should_load_token=False) assert not sess.load_token.called
def test_oauth1session_not_authorized(): bp = mock.Mock(token=None) sess = OAuth1Session(client_key="ckey", client_secret="csec", blueprint=bp) assert sess.authorized == False
def test_oauth1session_authorized(): bp = mock.Mock(token=FAKE_OAUTH1_TOKEN) sess = OAuth1Session(client_key="ckey", client_secret="csec", blueprint=bp) assert sess.authorized == True