diff options
author | Manuel Buil <mbuil@suse.com> | 2018-04-16 10:24:34 +0200 |
---|---|---|
committer | Manuel Buil <mbuil@suse.com> | 2018-04-17 18:43:44 +0200 |
commit | dc76020bee7085a3e2e9d1bd94e4ad7904d3b77d (patch) | |
tree | 541ea271e5383411f6d037ec7f27fce52c1f3ce1 /snaps/openstack/utils/tests/neutron_utils_tests.py | |
parent | bf07de830d7517f7173a3e8a68e1fa6dac2539da (diff) |
Add listing security groups functionality
JIRA: SNAPS-302
Be able to list the available security groups
Change-Id: I82e2daeb388f4eb3bc8cbc5fd02006b30b959c2f
Signed-off-by: Manuel Buil <mbuil@suse.com>
Diffstat (limited to 'snaps/openstack/utils/tests/neutron_utils_tests.py')
-rw-r--r-- | snaps/openstack/utils/tests/neutron_utils_tests.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/snaps/openstack/utils/tests/neutron_utils_tests.py b/snaps/openstack/utils/tests/neutron_utils_tests.py index cd293ca..1c874cc 100644 --- a/snaps/openstack/utils/tests/neutron_utils_tests.py +++ b/snaps/openstack/utils/tests/neutron_utils_tests.py @@ -1010,6 +1010,33 @@ class NeutronUtilsSecurityGroupTests(OSComponentTestCase): self.assertEqual(self.security_groups[0].id, sec_grp_1b.id) self.assertEqual(self.security_groups[1].id, sec_grp_2b.id) + def test_create_list_sec_grp_no_rules(self): + """ + Tests the neutron_utils.create_security_group() and + list_security_groups function + """ + sec_grp_settings = SecurityGroupConfig( + name=self.sec_grp_name + "-1", description='hello group') + self.security_groups.append(neutron_utils.create_security_group( + self.neutron, self.keystone, sec_grp_settings)) + + sec_grp_settings2 = SecurityGroupConfig( + name=self.sec_grp_name + "-2", description='hola group') + self.security_groups.append(neutron_utils.create_security_group( + self.neutron, self.keystone, sec_grp_settings2)) + + returned_sec_groups = neutron_utils.list_security_groups(self.neutron) + + self.assertIsNotNone(returned_sec_groups) + worked = 0 + for sg in returned_sec_groups: + if sec_grp_settings.name == sg.name: + worked += 1 + elif sec_grp_settings2.name == sg.name: + worked += 1 + + self.assertEqual(worked, 2) + class NeutronUtilsFloatingIpTests(OSComponentTestCase): """ |