Esempio n. 1
0
    def test_get_event_fails(self):
        scenario = events.CeilometerEventsCreateUserAndGetEvent(self.context)

        scenario._list_events = mock.MagicMock(return_value=[])
        scenario._get_event = mock.MagicMock()

        self.assertRaises(exceptions.RallyException, scenario.run)

        self.mock_identity.return_value.create_user.assert_called_once_with()
        scenario._list_events.assert_called_with()
        self.assertFalse(scenario._get_event.called)
Esempio n. 2
0
    def test_get_event(self):
        scenario = events.CeilometerEventsCreateUserAndGetEvent(self.context)

        scenario._user_create = mock.MagicMock()
        scenario._list_events = mock.MagicMock()
        scenario._get_event = mock.MagicMock()
        scenario._list_events.return_value = [mock.Mock(message_id="fake_id")]
        scenario.run()
        scenario._user_create.assert_called_once_with()
        scenario._list_events.assert_called_with()
        scenario._get_event.assert_called_with(event_id="fake_id")