def test_successful_sierra_sesssion_instance_has_access_token_parameter( self): with SierraSession(self.base, self.key, self.secret) as session: self.assertIsInstance(session.access_token, str)
def test_session_with_invalid_secret_raises_exception(self): secret = 'invalid secret' with self.assertRaises(MissingTokenError): with SierraSession(self.base, self.key, secret) as session: pass
def test_successful_sierra_session(self): with SierraSession(self.base, self.key, self.secret) as session: self.assertIsInstance(session.token, OAuth2Token)
def test_session_with_incorrect_key_raises_exception(self): with self.assertRaises(MissingTokenError): with SierraSession(self.base, 'invalid_key', self.secret): pass
def test_session_with_secret_none_raises_exception(self): key = 'some_key' secret = None with self.assertRaises(TypeError): with SierraSession(self.base, key, secret): pass
def test_session_with_key_none_raises_exception(self): key = None secret = 'some_secret' with self.assertRaises(TypeError): with SierraSession(self.base, key, secret) as session: pass
def test_session_without_base_url(self): with self.assertRaises(TypeError): with SierraSession(None, self.key, self.secret) as session: pass
def test_session_without_parameters(self): with self.assertRaises(TypeError): with SierraSession() as session: pass