1# Licensed under the Apache License, Version 2.0 (the "License"); you may 2# not use this file except in compliance with the License. You may obtain 3# a copy of the License at 4# 5# http://www.apache.org/licenses/LICENSE-2.0 6# 7# Unless required by applicable law or agreed to in writing, software 8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10# License for the specific language governing permissions and limitations 11# under the License. 12 13from openstack.tests.unit import base 14 15from openstack.orchestration.v1 import software_deployment 16 17FAKE = { 18 'id': 'ce8ae86c-9810-4cb1-8888-7fb53bc523bf', 19 'action': 'CREATE', 20 'config_id': 'CONFIG ID', 21 'creation_time': '2015-03-09T12:15:57', 22 'server_id': 'FAKE_SERVER', 23 'stack_user_project_id': 'ANOTHER PROJECT', 24 'status': 'IN_PROGRESS', 25 'status_reason': 'Why are we here?', 26 'input_values': {'foo': 'bar'}, 27 'output_values': {'baz': 'zoo'}, 28 'updated_time': '2015-03-09T12:15:57', 29} 30 31 32class TestSoftwareDeployment(base.TestCase): 33 34 def test_basic(self): 35 sot = software_deployment.SoftwareDeployment() 36 self.assertEqual('software_deployment', sot.resource_key) 37 self.assertEqual('software_deployments', sot.resources_key) 38 self.assertEqual('/software_deployments', sot.base_path) 39 self.assertTrue(sot.allow_create) 40 self.assertTrue(sot.allow_fetch) 41 self.assertTrue(sot.allow_commit) 42 self.assertTrue(sot.allow_delete) 43 self.assertTrue(sot.allow_list) 44 45 def test_make_it(self): 46 sot = software_deployment.SoftwareDeployment(**FAKE) 47 self.assertEqual(FAKE['id'], sot.id) 48 self.assertEqual(FAKE['action'], sot.action) 49 self.assertEqual(FAKE['config_id'], sot.config_id) 50 self.assertEqual(FAKE['creation_time'], sot.created_at) 51 self.assertEqual(FAKE['server_id'], sot.server_id) 52 self.assertEqual(FAKE['stack_user_project_id'], 53 sot.stack_user_project_id) 54 self.assertEqual(FAKE['input_values'], sot.input_values) 55 self.assertEqual(FAKE['output_values'], sot.output_values) 56 self.assertEqual(FAKE['status'], sot.status) 57 self.assertEqual(FAKE['status_reason'], sot.status_reason) 58 self.assertEqual(FAKE['updated_time'], sot.updated_at) 59