~ubuntu-branches/ubuntu/vivid/heat/vivid

« back to all changes in this revision

Viewing changes to heat/tests/test_cloud_config.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Corey Bryant
  • Date: 2015-01-06 08:55:22 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150106085522-4o3hnaff5lacvtrf
Tags: 2015.1~b1-0ubuntu1
[ Chuck Short ]
* Open up for vivid.
* debian/control: Update bzr branch. 
* debian/control: Add python-saharaclient,
  python-osprofiler, python-oslo.middleware, python-oslo.serialization.
* debian/patches/fix-reqirements.patch: Refreshed.
* debian/patches/skip-tests.patch: Updated to skip more tests.
* debian/rules: Skip integration tests.

[ Corey Bryant ]
* New upstream release.
  - d/control: Align requirements with upstream.
  - d/watch: Update uversionmangle for kilo beta naming.
  - d/rules: Generate heat.conf.sample and apply patch before copy.
  - d/rules: Run base tests instead of integration tests.
  - d/p/fix-requirements.patch: Refreshed.
  - d/p/remove-gettextutils-import.patch: Cherry picked from master.
* d/control: Bumped Standards-Version to 3.9.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#    under the License.
13
13
 
14
14
import mock
 
15
import uuid
15
16
 
16
17
from heat.engine import parser
17
18
from heat.engine.resources.software_config import cloud_config as cc
18
19
from heat.engine import template
19
 
from heat.tests.common import HeatTestCase
 
20
from heat.tests import common
20
21
from heat.tests import utils
21
22
 
22
23
 
23
 
class CloudConfigTest(HeatTestCase):
 
24
class CloudConfigTest(common.HeatTestCase):
24
25
 
25
26
    def setUp(self):
26
27
        super(CloudConfigTest, self).setUp()
38
39
                        'Properties': self.properties
39
40
                    }}}))
40
41
        self.config = self.stack['config_mysql']
41
 
        heat = mock.MagicMock()
42
 
        self.config.heat = heat
43
 
        self.software_configs = heat.return_value.software_configs
 
42
        self.rpc_client = mock.MagicMock()
 
43
        self.config._rpc_client = self.rpc_client
44
44
 
45
45
    def test_resource_mapping(self):
46
46
        mapping = cc.resource_mapping()
50
50
        self.assertIsInstance(self.config, cc.CloudConfig)
51
51
 
52
52
    def test_handle_create(self):
53
 
        sc = mock.MagicMock()
54
53
        config_id = 'c8a19429-7fde-47ea-a42f-40045488226c'
55
 
        sc.id = config_id
56
 
        self.software_configs.create.return_value = sc
 
54
        value = {'id': config_id}
 
55
        self.rpc_client.create_software_config.return_value = value
 
56
        self.config.id = uuid.uuid4().hex
57
57
        self.config.handle_create()
58
58
        self.assertEqual(config_id, self.config.resource_id)
59
 
        kwargs = self.software_configs.create.call_args[1]
60
 
        self.assertEqual('#cloud-config\n{foo: bar}\n', kwargs['config'])
 
59
        kwargs = self.rpc_client.create_software_config.call_args[1]
 
60
        self.assertEqual({
 
61
            'name': self.config.physical_resource_name(),
 
62
            'config': '#cloud-config\n{foo: bar}\n',
 
63
            'group': 'Heat::Ungrouped'
 
64
        }, kwargs)