summaryrefslogtreecommitdiff
path: root/ironic/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-08-05 18:18:14 +0000
committerGerrit Code Review <review@openstack.org>2019-08-05 18:18:14 +0000
commit65795f1e86fb3d63aeb9a259a21c7143a0515be1 (patch)
tree3c997dfa2f320d307714c08b7e1a750014bb34cf /ironic/tests
parentb69fbbd65c6fca89309d49885560ec38501bf1c5 (diff)
parent7caf22fe0b30c233b4022dcbf6b05aaed4e4b955 (diff)
downloadironic-65795f1e86fb3d63aeb9a259a21c7143a0515be1.tar.gz
Merge "Filter security group list on the ID's we expect" into stable/stein
Diffstat (limited to 'ironic/tests')
-rw-r--r--ironic/tests/unit/common/test_neutron.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/ironic/tests/unit/common/test_neutron.py b/ironic/tests/unit/common/test_neutron.py
index b4464edc1..6a5c8b087 100644
--- a/ironic/tests/unit/common/test_neutron.py
+++ b/ironic/tests/unit/common/test_neutron.py
@@ -268,23 +268,23 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
self.assertIsNone(
neutron._verify_security_groups(sg_ids, client))
- client.list_security_groups.assert_called_once_with()
+ client.list_security_groups.assert_called_once_with(
+ fields='id', id=sg_ids)
def test_verify_sec_groups_less_than_configured(self):
sg_ids = []
for i in range(2):
sg_ids.append(uuidutils.generate_uuid())
- expected_vals = {'security_groups': []}
- for sg in sg_ids:
- expected_vals['security_groups'].append({'id': sg})
+ expected_vals = {'security_groups': [{'id': sg_ids[0]}]}
client = mock.MagicMock()
client.list_security_groups.return_value = expected_vals
self.assertIsNone(
neutron._verify_security_groups(sg_ids[:1], client))
- client.list_security_groups.assert_called_once_with()
+ client.list_security_groups.assert_called_once_with(
+ fields='id', id=sg_ids[:1])
def test_verify_sec_groups_more_than_configured(self):
sg_ids = []
@@ -298,7 +298,8 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
self.assertRaises(
exception.NetworkError,
neutron._verify_security_groups, sg_ids, client)
- client.list_security_groups.assert_called_once_with()
+ client.list_security_groups.assert_called_once_with(
+ fields='id', id=sg_ids)
def test_verify_sec_groups_no_sg_from_neutron(self):
sg_ids = []
@@ -311,7 +312,8 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
self.assertRaises(
exception.NetworkError,
neutron._verify_security_groups, sg_ids, client)
- client.list_security_groups.assert_called_once_with()
+ client.list_security_groups.assert_called_once_with(
+ fields='id', id=sg_ids)
def test_verify_sec_groups_exception_by_neutronclient(self):
sg_ids = []
@@ -326,7 +328,8 @@ class TestNeutronNetworkActions(db_base.DbTestCase):
exception.NetworkError,
"Could not retrieve security groups",
neutron._verify_security_groups, sg_ids, client)
- client.list_security_groups.assert_called_once_with()
+ client.list_security_groups.assert_called_once_with(
+ fields='id', id=sg_ids)
def test_add_ports_with_client_id_to_network(self):
self._test_add_ports_to_network(is_client_id=True)