Merge "Fix security group choice field population"

This commit is contained in:
Jenkins 2017-06-28 11:06:00 +00:00 committed by Gerrit Code Review
commit f98e08d827
2 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@ from horizon import forms as hz_forms
from horizon import messages
from openstack_dashboard.api import cinder
from openstack_dashboard.api import glance
from openstack_dashboard.api import network
from openstack_dashboard.api import neutron
from openstack_dashboard.api import nova
from oslo_log import log as logging
from oslo_log import versionutils
@ -428,7 +428,7 @@ class SecurityGroupChoiceField(DynamicChoiceField):
# TODO(pbourke): remove sorted when supported natively in Horizon
# (https://bugs.launchpad.net/horizon/+bug/1692972)
for secgroup in sorted(
network.security_group_list(request),
neutron.security_group_list(request),
key=lambda e: e.name_or_id):
if not secgroup.name_or_id.startswith('murano--'):
self.choices.append((secgroup.name_or_id, secgroup.name_or_id))

View File

@ -583,9 +583,9 @@ class TestSecurityGroupChoiceField(testtools.TestCase):
self.request = {'request': mock.Mock()}
self.addCleanup(mock.patch.stopall)
@mock.patch.object(fields, 'network')
def test_update(self, mock_network):
mock_network.security_group_list.return_value = [
@mock.patch.object(fields, 'neutron')
def test_update(self, mock_neutron):
mock_neutron.security_group_list.return_value = [
mock.Mock(name_or_id='foo'),
mock.Mock(name_or_id='bar')
]