def test_make_session_with_access(self): tool = PMRTool() info = PMRInfo() info.update_token('test', 'token') session = tool.make_session() self.assertTrue(isinstance(session, OAuth1Session)) info.update_token('', '')
def test_requestTemporaryPassword(self): # Available with access info = PMRInfo() info.update_token('test', 'token') result = self._tool.requestTemporaryPassword('http://example.com/w/1') self.assertEqual(result['user'], 'tester') self.assertEqual(result['key'], 'secret') info.update_token('', '') result = self._tool.requestTemporaryPassword('http://example.com/w/1') self.assertTrue(result is None)
def test_hasAccess(self): # update tokens using another instance info = PMRInfo() t = PMRTool() # Fresh token should have no access self.assertFalse(t.hasAccess()) info.update_token('test', 'token') # Now it's true self.assertTrue(t.hasAccess()) # revoke access again. info.update_token('', '') # Now it's false again. self.assertFalse(t.hasAccess())