~ubuntu-branches/ubuntu/utopic/heat/utopic-proposed

« back to all changes in this revision

Viewing changes to heat/tests/test_software_config.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-09-08 09:40:59 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20140908094059-pzysrm0uy4senjez
Tags: 2014.2~b3-0ubuntu1
New upstream version. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
from heatclient.exc import HTTPNotFound
15
15
import mock
16
16
 
17
 
from heat.common import exception
18
17
from heat.engine import parser
19
18
from heat.engine.resources.software_config import software_config as sc
20
19
from heat.engine import template
75
74
        self.software_configs.delete.side_effect = HTTPNotFound()
76
75
        self.assertIsNone(self.config.handle_delete())
77
76
 
78
 
    def test_get_software_config(self):
79
 
        config_id = 'c8a19429-7fde-47ea-a42f-40045488226c'
80
 
        value = mock.MagicMock()
81
 
        value.config = '#!/bin/bash'
82
 
        self.software_configs.get.return_value = value
83
 
        heatclient = self.heatclient
84
 
        config = sc.SoftwareConfig.get_software_config(heatclient, config_id)
85
 
        self.assertEqual('#!/bin/bash', config)
86
 
 
87
 
        self.software_configs.get.side_effect = HTTPNotFound()
88
 
        err = self.assertRaises(
89
 
            exception.SoftwareConfigMissing,
90
 
            self.config.get_software_config,
91
 
            heatclient, config_id)
92
 
        self.assertEqual(
93
 
            ('The config (c8a19429-7fde-47ea-a42f-40045488226c) '
94
 
             'could not be found.'), str(err))
95
 
 
96
77
    def test_resolve_attribute(self):
97
78
        self.assertIsNone(self.config._resolve_attribute('others'))
98
79
        self.config.resource_id = None
104
85
        self.assertEqual(
105
86
            '#!/bin/bash', self.config._resolve_attribute('config'))
106
87
        self.software_configs.get.side_effect = HTTPNotFound()
107
 
        self.assertEqual('', self.config._resolve_attribute('config'))
 
88
        self.assertEqual(None, self.config._resolve_attribute('config'))