diff options
author | Steve Baker <sbaker@redhat.com> | 2014-02-20 09:54:28 +1300 |
---|---|---|
committer | Steve Baker <sbaker@redhat.com> | 2014-02-20 10:21:32 +1300 |
commit | 7c6bf662c69db535ad5992a3741acb79b059a87f (patch) | |
tree | 0f64e5974cd3bfbc26963dd2b257dc283792dac8 /heat/tests/test_support.py | |
parent | 3f7ba122669b38ee46dabd90fa310bcf26eb269d (diff) | |
download | heat-7c6bf662c69db535ad5992a3741acb79b059a87f.tar.gz |
Refactor SupportStatus into its own module
This will allow a properties to also use SupportStatus
Change-Id: I66783eaefcb7c773120c0f1e5cb7eeacbd483cf7
Diffstat (limited to 'heat/tests/test_support.py')
-rw-r--r-- | heat/tests/test_support.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/heat/tests/test_support.py b/heat/tests/test_support.py new file mode 100644 index 000000000..2babe8318 --- /dev/null +++ b/heat/tests/test_support.py @@ -0,0 +1,50 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from heat.engine import support + +from heat.tests.common import HeatTestCase + + +class SupportStatusTest(HeatTestCase): + def test_valid_status(self): + status = support.SupportStatus( + status=support.DEPRECATED, + message='test_message', + version='test_version' + ) + self.assertEqual('DEPRECATED', status.status) + self.assertEqual('test_message', status.message) + self.assertEqual('test_version', status.version) + self.assertEqual({ + 'status': 'DEPRECATED', + 'message': 'test_message', + 'version': 'test_version' + }, status.to_dict()) + + def test_invalid_status(self): + status = support.SupportStatus( + status='RANDOM', + message='test_message', + version='test_version' + ) + self.assertEqual(support.UNKNOWN, status.status) + self.assertEqual('Specified status is invalid, defaulting to UNKNOWN', + status.message) + self.assertIsNone(status.version) + self.assertEqual({ + 'status': 'UNKNOWN', + 'message': 'Specified status is invalid, defaulting to UNKNOWN', + 'version': None + }, status.to_dict()) |