本文整理匯總了Python中gns3.cloud.rackspace_ctrl.RackspaceCtrl.post_fn方法的典型用法代碼示例。如果您正苦於以下問題:Python RackspaceCtrl.post_fn方法的具體用法?Python RackspaceCtrl.post_fn怎麽用?Python RackspaceCtrl.post_fn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gns3.cloud.rackspace_ctrl.RackspaceCtrl
的用法示例。
在下文中一共展示了RackspaceCtrl.post_fn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_token_parsed
# 需要導入模塊: from gns3.cloud.rackspace_ctrl import RackspaceCtrl [as 別名]
# 或者: from gns3.cloud.rackspace_ctrl.RackspaceCtrl import post_fn [as 別名]
def test_token_parsed(self):
""" Ensure that the token is set. """
ctrl = RackspaceCtrl('valid_user', 'valid_api_key', 'http://foo.bar:8888')
ctrl.post_fn = stub_rackspace_identity_post
ctrl.authenticate()
self.assertEqual('abcdefgh0123456789', ctrl.token)
示例2: test_authenticate_invalid_user
# 需要導入模塊: from gns3.cloud.rackspace_ctrl import RackspaceCtrl [as 別名]
# 或者: from gns3.cloud.rackspace_ctrl.RackspaceCtrl import post_fn [as 別名]
def test_authenticate_invalid_user(self):
""" Ensure authentication with invalid user credentials fails. """
ctrl = RackspaceCtrl('invalid_user', 'invalid_api_key', 'http://foo.bar:8888')
ctrl.post_fn = stub_rackspace_identity_post
auth_result = ctrl.authenticate()
self.assertEqual(auth_result, False)
self.assertIsNone(ctrl.token)
示例3: test_authenticate_empty_user
# 需要導入模塊: from gns3.cloud.rackspace_ctrl import RackspaceCtrl [as 別名]
# 或者: from gns3.cloud.rackspace_ctrl.RackspaceCtrl import post_fn [as 別名]
def test_authenticate_empty_user(self):
""" Ensure authentication with empty string as username fails. """
ctrl = RackspaceCtrl('', 'valid_api_key')
ctrl.post_fn = stub_rackspace_identity_post
auth_result = ctrl.authenticate()
self.assertEqual(auth_result, False)
self.assertIsNone(ctrl.token)
示例4: test_authenticate_empty_apikey
# 需要導入模塊: from gns3.cloud.rackspace_ctrl import RackspaceCtrl [as 別名]
# 或者: from gns3.cloud.rackspace_ctrl.RackspaceCtrl import post_fn [as 別名]
def test_authenticate_empty_apikey(self):
""" Ensure authentication with empty string as api_key fails. """
ctrl = RackspaceCtrl('valid_user', '', 'http://foo.bar:8888')
ctrl.post_fn = stub_rackspace_identity_post
auth_result = ctrl.authenticate()
self.assertEqual(auth_result, False)
self.assertIsNone(ctrl.token)