def test_inconsistent_application_name_rejected(self): """Catch an attempt to specify inconsistent application_names.""" engine = NoNetworkAuthorizationEngine( SERVICE_ROOT, 'application name1') self.assertRaises(ValueError, NoNetworkLaunchpad.login_with, "application name2", authorization_engine=engine)
def test_authorization_engine_is_propagated(self): # You can pass in a custom authorization engine, which will be # used to get a request token and exchange it for an access # token. engine = NoNetworkAuthorizationEngine(SERVICE_ROOT, 'application name') NoNetworkLaunchpad.login_with(authorization_engine=engine) self.assertEquals(engine.request_tokens_obtained, 1) self.assertEquals(engine.access_tokens_obtained, 1)
def test_inconsistent_allow_access_levels_rejected(self): """Catch an attempt to specify inconsistent allow_access_levels.""" engine = NoNetworkAuthorizationEngine( SERVICE_ROOT, consumer_name="consumer", allow_access_levels=['FOO']) self.assertRaises(ValueError, NoNetworkLaunchpad.login_with, None, consumer_name="consumer", allow_access_levels=['BAR'], authorization_engine=engine)
def setUp(self): """Clear out the list of simulated responses.""" SimulatedResponsesLaunchpad.responses = [] self.engine = NoNetworkAuthorizationEngine('http://api.example.com/', 'application name')
def test_consumer_name_identifies_app(self): NoNetworkAuthorizationEngine(SERVICE_ROOT, consumer_name='name')
def test_application_name_identifies_app(self): NoNetworkAuthorizationEngine(SERVICE_ROOT, application_name='name')