本文整理汇总了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)