diff options
author | Steven Pisarski <s.pisarski@cablelabs.com> | 2017-07-24 15:08:30 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-07-24 15:08:30 +0000 |
commit | ad9354631208bc565dbbade119c6be89b4a6a5d4 (patch) | |
tree | b85c060a6c992b3c924454d60b4f1293329824e0 | |
parent | 8e9920d2e8bd4a3d404b4589312cdc9510708a37 (diff) | |
parent | 7c3bbf62df8553475b787ffd234cd3df3fa0c90b (diff) |
Merge "Created new class ProjectSettingsError."
-rw-r--r-- | snaps/openstack/create_project.py | 8 | ||||
-rw-r--r-- | snaps/openstack/tests/create_project_tests.py | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/snaps/openstack/create_project.py b/snaps/openstack/create_project.py index 0384ccc..a20033e 100644 --- a/snaps/openstack/create_project.py +++ b/snaps/openstack/create_project.py @@ -131,5 +131,11 @@ class ProjectSettings: self.enabled = True if not self.name: - raise Exception( + raise ProjectSettingsError( "The attribute name is required for ProjectSettings") + + +class ProjectSettingsError(Exception): + """ + Exception to be thrown when project settings attributes are incorrect + """ diff --git a/snaps/openstack/tests/create_project_tests.py b/snaps/openstack/tests/create_project_tests.py index 3c6b2d1..f2af0d9 100644 --- a/snaps/openstack/tests/create_project_tests.py +++ b/snaps/openstack/tests/create_project_tests.py @@ -15,7 +15,8 @@ import unittest import uuid -from snaps.openstack.create_project import OpenStackProject, ProjectSettings +from snaps.openstack.create_project import ( + OpenStackProject, ProjectSettings, ProjectSettingsError) from snaps.openstack.create_security_group import OpenStackSecurityGroup from snaps.openstack.create_security_group import SecurityGroupSettings from snaps.openstack.create_user import OpenStackUser @@ -32,11 +33,11 @@ class ProjectSettingsUnitTests(unittest.TestCase): """ def test_no_params(self): - with self.assertRaises(Exception): + with self.assertRaises(ProjectSettingsError): ProjectSettings() def test_empty_config(self): - with self.assertRaises(Exception): + with self.assertRaises(ProjectSettingsError): ProjectSettings(**dict()) def test_name_only(self): |