From 0a5181d00709e029c317aeb90c75e9cd4fa7d130 Mon Sep 17 00:00:00 2001 From: spisarski Date: Fri, 21 Jul 2017 08:27:22 -0600 Subject: Created new exceptions for security group settings Raising SecurityGroupSettingsError in SecurityGroupSettings and SecurityGroupRuleSettingsError in SecurityGroupRuleSettings instead of Exception. JIRA: SNAPS-137 Change-Id: I959ffe9a247dc9adffbef460119ba94ad86fd3f0 Signed-off-by: spisarski --- snaps/openstack/tests/create_security_group_tests.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'snaps/openstack/tests/create_security_group_tests.py') diff --git a/snaps/openstack/tests/create_security_group_tests.py b/snaps/openstack/tests/create_security_group_tests.py index 75c6387..dd28d7d 100644 --- a/snaps/openstack/tests/create_security_group_tests.py +++ b/snaps/openstack/tests/create_security_group_tests.py @@ -19,7 +19,9 @@ from snaps.openstack import create_security_group from snaps.openstack.create_security_group import (SecurityGroupSettings, SecurityGroupRuleSettings, Direction, Ethertype, - Protocol) + Protocol, + SecurityGroupRuleSettingsError, + SecurityGroupSettingsError) from snaps.openstack.tests import validation_utils from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase from snaps.openstack.utils import neutron_utils @@ -33,19 +35,19 @@ class SecurityGroupRuleSettingsUnitTests(unittest.TestCase): """ def test_no_params(self): - with self.assertRaises(Exception): + with self.assertRaises(SecurityGroupRuleSettingsError): SecurityGroupRuleSettings() def test_empty_config(self): - with self.assertRaises(Exception): + with self.assertRaises(SecurityGroupRuleSettingsError): SecurityGroupRuleSettings(**dict()) def test_name_only(self): - with self.assertRaises(Exception): + with self.assertRaises(SecurityGroupRuleSettingsError): SecurityGroupRuleSettings(sec_grp_name='foo') def test_config_with_name_only(self): - with self.assertRaises(Exception): + with self.assertRaises(SecurityGroupRuleSettingsError): SecurityGroupRuleSettings(**{'sec_grp_name': 'foo'}) def test_name_and_direction(self): @@ -105,11 +107,11 @@ class SecurityGroupSettingsUnitTests(unittest.TestCase): """ def test_no_params(self): - with self.assertRaises(Exception): + with self.assertRaises(SecurityGroupSettingsError): SecurityGroupSettings() def test_empty_config(self): - with self.assertRaises(Exception): + with self.assertRaises(SecurityGroupSettingsError): SecurityGroupSettings(**dict()) def test_name_only(self): @@ -123,7 +125,7 @@ class SecurityGroupSettingsUnitTests(unittest.TestCase): def test_invalid_rule(self): rule_setting = SecurityGroupRuleSettings(sec_grp_name='bar', direction=Direction.ingress) - with self.assertRaises(Exception): + with self.assertRaises(SecurityGroupSettingsError): SecurityGroupSettings(name='foo', rule_settings=[rule_setting]) def test_all(self): -- cgit 1.2.3-korg