def test_update_called(self):
        def _verify_called(host, context, free_ram_mb_delta,
                           free_disk_gb_delta, work_delta, vm_delta):
            self.assertEquals(free_ram_mb_delta, 123)
            self.assertEquals(free_disk_gb_delta, 456)
            self.assertEquals(vm_delta, -1)
            self.assertEquals(work_delta, -1)

        self.stubs.Set(cinder.db.api, "compute_node_utilization_update",
                       _verify_called)
        msg = self._make_msg("myhost", "delete.end")
        self.assertTrue(cn.notify(msg))
 def test_bad_event_suffix(self):
     msg = self._make_msg("myhost", "mymethod.badsuffix")
     self.assertFalse(cn.notify(msg))
 def test_bad_publisher_id(self):
     msg = self._make_msg("myhost", "mymethod.start")
     msg['publisher_id'] = 'badpublisher'
     self.assertFalse(cn.notify(msg))
 def test_event_type(self):
     msg = self._make_msg("myhost", "mymethod")
     msg['event_type'] = 'random'
     self.assertFalse(cn.notify(msg))