本文整理汇总了Python中nailgun.objects.Cluster.update_attributes方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.update_attributes方法的具体用法?Python Cluster.update_attributes怎么用?Python Cluster.update_attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.objects.Cluster
的用法示例。
在下文中一共展示了Cluster.update_attributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_auth_credentials
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import update_attributes [as 别名]
def test_get_auth_credentials(self):
expected_username = "test"
expected_password = "test"
expected_tenant = "test"
expected_auth_host = "0.0.0.0"
expected_auth_url = "http://{0}:{1}/{2}/".format(
expected_auth_host, settings.AUTH_PORT,
settings.OPENSTACK_API_VERSION["keystone"])
expected = (expected_username, expected_password, expected_tenant,
expected_auth_url)
cluster = self.env.create_cluster(api=False)
updated_attributes = {
"editable": {
"workloads_collector": {
"username": {"value": expected_username},
"password": {"value": expected_password},
"tenant": {"value": expected_tenant}
}
}
}
Cluster.update_attributes(cluster, updated_attributes)
get_host_for_auth_path = ("nailgun.statistics.utils."
"get_mgmt_ip_of_cluster_controller")
with patch(get_host_for_auth_path,
return_value=expected_auth_host):
client_provider = helpers.ClientProvider(cluster)
creds = client_provider.credentials
self.assertEqual(expected, creds)
示例2: check_creds
# 需要导入模块: from nailgun.objects import Cluster [as 别名]
# 或者: from nailgun.objects.Cluster import update_attributes [as 别名]
def check_creds(updated_attrs, expected_creds):
Cluster.update_attributes(cluster, updated_attributes)
with patch(get_host_for_auth_path,
return_value=expected_auth_host):
client_provider = helpers.ClientProvider(cluster)
creds = client_provider.credentials
self.assertEqual(expected_creds, creds)