~ubuntu-branches/ubuntu/trusty/heat/trusty

« back to all changes in this revision

Viewing changes to heat/tests/test_event.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2013-09-08 21:51:19 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130908215119-r939tu4aumqgdrkx
Tags: 2013.2~b3-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/control: Add python-netaddr as build-dep.
* debian/heat-common.install: Remove heat-boto and associated man-page
* debian/heat-common.install: Remove heat-cfn and associated man-page
* debian/heat-common.install: Remove heat-watch and associated man-page
* debian/patches/fix-sqlalchemy-0.8.patch: Dropped

[ Adam Gandelman ]
* debian/patches/default-kombu.patch: Dropped.
* debian/patches/default-sqlite.patch: Refreshed.
* debian/*.install, rules: Install heat.conf.sample as common
  config file in heat-common. Drop other per-package configs, they
  are no longer used.
* debian/rules: Clean pbr .egg from build dir if it exists.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from heat.engine import event
21
21
 
22
22
from heat.tests.common import HeatTestCase
23
 
from heat.tests.utils import dummy_context
24
 
from heat.tests.utils import setup_dummy_db
25
23
from heat.tests import generic_resource as generic_rsrc
 
24
from heat.tests import utils
26
25
 
27
26
 
28
27
tmpl = {
41
40
        super(EventTest, self).setUp()
42
41
        self.username = 'event_test_user'
43
42
 
44
 
        setup_dummy_db()
45
 
        self.ctx = dummy_context()
 
43
        utils.setup_dummy_db()
 
44
        self.ctx = utils.dummy_context()
46
45
 
47
46
        self.m.ReplayAll()
48
47
 
60
59
    def test_load(self):
61
60
        self.resource.resource_id_set('resource_physical_id')
62
61
 
63
 
        e = event.Event(self.ctx, self.stack, self.resource,
64
 
                        'TEST', 'IN_PROGRESS', 'Testing',
65
 
                        'wibble', self.resource.properties)
 
62
        e = event.Event(self.ctx, self.stack, 'TEST', 'IN_PROGRESS', 'Testing',
 
63
                        'wibble', self.resource.properties,
 
64
                        self.resource.name, self.resource.type())
66
65
 
67
66
        e.store()
68
67
        self.assertNotEqual(e.id, None)
70
69
        loaded_e = event.Event.load(self.ctx, e.id)
71
70
 
72
71
        self.assertEqual(self.stack.id, loaded_e.stack.id)
73
 
        self.assertEqual(self.resource.name, loaded_e.resource.name)
74
 
        self.assertEqual(self.resource.id, loaded_e.resource.id)
 
72
        self.assertEqual(self.resource.name, loaded_e.resource_name)
75
73
        self.assertEqual('wibble', loaded_e.physical_resource_id)
76
74
        self.assertEqual('TEST', loaded_e.action)
77
75
        self.assertEqual('IN_PROGRESS', loaded_e.status)
82
80
    def test_load_given_stack_event(self):
83
81
        self.resource.resource_id_set('resource_physical_id')
84
82
 
85
 
        e = event.Event(self.ctx, self.stack, self.resource,
86
 
                        'TEST', 'IN_PROGRESS', 'Testing',
87
 
                        'wibble', self.resource.properties)
 
83
        e = event.Event(self.ctx, self.stack, 'TEST', 'IN_PROGRESS', 'Testing',
 
84
                        'wibble', self.resource.properties,
 
85
                        self.resource.name, self.resource.type())
88
86
 
89
87
        e.store()
90
88
        self.assertNotEqual(e.id, None)
94
92
        loaded_e = event.Event.load(self.ctx, e.id, stack=self.stack, event=ev)
95
93
 
96
94
        self.assertEqual(self.stack.id, loaded_e.stack.id)
97
 
        self.assertEqual(self.resource.name, loaded_e.resource.name)
98
 
        self.assertEqual(self.resource.id, loaded_e.resource.id)
 
95
        self.assertEqual(self.resource.name, loaded_e.resource_name)
99
96
        self.assertEqual('wibble', loaded_e.physical_resource_id)
100
97
        self.assertEqual('TEST', loaded_e.action)
101
98
        self.assertEqual('IN_PROGRESS', loaded_e.status)
104
101
        self.assertEqual({'Foo': 'goo'}, loaded_e.resource_properties)
105
102
 
106
103
    def test_identifier(self):
107
 
        e = event.Event(self.ctx, self.stack, self.resource,
108
 
                        'TEST', 'IN_PROGRESS', 'Testing',
109
 
                        'wibble', self.resource.properties)
 
104
        e = event.Event(self.ctx, self.stack, 'TEST', 'IN_PROGRESS', 'Testing',
 
105
                        'wibble', self.resource.properties,
 
106
                        self.resource.name, self.resource.type())
110
107
 
111
108
        eid = e.store()
112
109
        expected_identifier = {
122
119
                'Properties': {'Foo': False}}
123
120
        rname = 'bad_resource'
124
121
        res = generic_rsrc.ResourceWithRequiredProps(rname, tmpl, self.stack)
125
 
        e = event.Event(self.ctx, self.stack, res,
126
 
                        'TEST', 'IN_PROGRESS', 'Testing',
127
 
                        'wibble', res.properties)
 
122
        e = event.Event(self.ctx, self.stack, 'TEST', 'IN_PROGRESS', 'Testing',
 
123
                        'wibble', res.properties, res.name, res.type())
128
124
        self.assertTrue('Error' in e.resource_properties)