~james-page/charms/precise/cinder/pre-test

« back to all changes in this revision

Viewing changes to unit_tests/test_cinder_hooks.py

  • Committer: Marco Ceppi
  • Date: 2013-11-04 00:25:51 UTC
  • mfrom: (24.1.1 cinder-current)
  • Revision ID: marco@ceppi.net-20131104002551-dcprz9nvdcjmgw5c
[james-page] Updates for ceilometer integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
        super(TestChangedHooks, self).setUp(hooks, TO_PATCH)
127
127
        self.config.side_effect = self.test_config.get_all
128
128
 
 
129
    @patch.object(hooks, 'amqp_joined')
 
130
    def test_upgrade_charm_no_amqp(self, _joined):
 
131
        self.relation_ids.return_value = []
 
132
        hooks.hooks.execute(['hooks/upgrade-charm'])
 
133
        _joined.assert_not_called()
 
134
 
 
135
    @patch.object(hooks, 'amqp_joined')
 
136
    def test_upgrade_charm_with_amqp(self, _joined):
 
137
        self.relation_ids.return_value = ['amqp:1']
 
138
        hooks.hooks.execute(['hooks/upgrade-charm'])
 
139
        _joined.assert_called_with(relation_id='amqp:1')
 
140
 
129
141
    @patch.object(hooks, 'configure_https')
130
142
    def test_config_changed(self, conf_https):
131
143
        '''It writes out all config'''
234
246
    def test_amqp_joined(self):
235
247
        '''It properly requests access to an amqp service'''
236
248
        hooks.hooks.execute(['hooks/amqp-relation-joined'])
237
 
        self.relation_set.assert_called_with(username='cinder', vhost='cinder')
 
249
        self.relation_set.assert_called_with(username='cinder',
 
250
                                             vhost='openstack',
 
251
                                             relation_id=None)
 
252
 
 
253
    def test_amqp_joined_passes_relation_id(self):
 
254
        ''' Ensures relation_id correct passed to relation_set for out of
 
255
            hook execution '''
 
256
        hooks.amqp_joined(relation_id='amqp:1')
 
257
        self.relation_set.assert_called_with(username='cinder',
 
258
                                             vhost='openstack',
 
259
                                             relation_id='amqp:1')
238
260
 
239
261
    def test_identity_service_joined(self):
240
262
        '''It properly requests unclustered endpoint via identity-service'''