Merge "Fixed test_update_restricted_networks"

This commit is contained in:
Jenkins 2015-12-10 11:13:02 +00:00 committed by Gerrit Code Review
commit f2aec0a6c7
2 changed files with 12 additions and 4 deletions

View File

@ -694,9 +694,12 @@ class NetworkManager(object):
iface.assigned_networks_list.append(ng)
break
else:
logger.warn("Cannot assign network %r appropriately for "
"node %r. Set unassigned network to the "
"interface %r", ng.name, node.name, ifaces[0].name)
logger.warning(
"Cannot assign network %r appropriately for "
"node %r. Set unassigned network to the "
"interface %r",
ng.name, node.name, ifaces[0].name
)
ifaces[0].assigned_networks_list.append(ng)
db().flush()

View File

@ -818,7 +818,12 @@ class TestNetworkManager(BaseNetworkManagerTest):
with patch.object(logger, 'warning') as mock_warn:
objects.Cluster.patch_attributes(
cluster, yaml.load(attributes_metadata % True))
mock_warn.assert_called_once()
mock_warn.assert_called_once_with(
"Cannot assign network %r appropriately for "
"node %r. Set unassigned network to the "
"interface %r",
"restricted_net", mock.ANY, mock.ANY
)
self.db.refresh(cluster)
assigned_nets_count = 0
for iface in cluster.nodes[0].interfaces: