Esempio n. 1
0
 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)
Esempio n. 3
0
    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)
Esempio n. 4
0
 def setUp(self):
     """Clear out the list of simulated responses."""
     SimulatedResponsesLaunchpad.responses = []
     self.engine = NoNetworkAuthorizationEngine('http://api.example.com/',
                                                'application name')
Esempio n. 5
0
 def test_consumer_name_identifies_app(self):
     NoNetworkAuthorizationEngine(SERVICE_ROOT, consumer_name='name')
Esempio n. 6
0
 def test_application_name_identifies_app(self):
     NoNetworkAuthorizationEngine(SERVICE_ROOT, application_name='name')