def test_project_credentials(self): sess = session.AdminSession(self.credentials) self.assertIsNone(sess.project_credentials) sess = session.AdminSession( self.credentials, project_credentials=self.project_credentials) self.assertEqual(sess.project_credentials, self.project_credentials)
def test_admin_session_service_request(self, mock_request): """ Revoke a device :return: """ sess = session.AdminSession(self.credentials, config=self.custom_config) response = sess.test_service.test_method(my_argument='Hello World') self.assertEqual(response, 'hello world')
def test_admin_session_missing_arg(self): sess = session.AdminSession(self.credentials, config=self.custom_config) self.assertRaises(TypeError, sess.test_service.test_method)
def test_admin_session_config(self): sess = session.AdminSession(self.credentials, config=self.custom_config) self.assertIsInstance(sess.test_service, service.BaseService) self.assertEqual(sess.test_service.__class__.__name__, 'test_service')
def test_admin_session_defaults(self): sess = session.AdminSession(self.credentials) self.assertTrue(hasattr(sess, "revoke")) self.assertIsInstance(sess.revoke, service.BaseService) self.assertEqual(sess.revoke.__class__.__name__, "revoke")