Пример #1
0
 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)
Пример #2
0
 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
Пример #3
0
 def test_successful_sierra_session(self):
     with SierraSession(self.base, self.key, self.secret) as session:
         self.assertIsInstance(session.token, OAuth2Token)
Пример #4
0
 def test_session_with_incorrect_key_raises_exception(self):
     with self.assertRaises(MissingTokenError):
         with SierraSession(self.base, 'invalid_key', self.secret):
             pass
Пример #5
0
 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
Пример #6
0
 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
Пример #7
0
 def test_session_without_base_url(self):
     with self.assertRaises(TypeError):
         with SierraSession(None, self.key, self.secret) as session:
             pass
Пример #8
0
 def test_session_without_parameters(self):
     with self.assertRaises(TypeError):
         with SierraSession() as session:
             pass