Exemple #1
0
    def test_list(self, mock_ceilometer_alarms__manager):

        ceil = resources.CeilometerAlarms()
        ceil.tenant_uuid = mock.MagicMock()
        mock_ceilometer_alarms__manager().list.return_value = ["a", "b", "c"]
        mock_ceilometer_alarms__manager.reset_mock()

        self.assertEqual(["a", "b", "c"], ceil.list())
        mock_ceilometer_alarms__manager().list.assert_called_once_with(
            q=[{"field": "project_id", "op": "eq", "value": ceil.tenant_uuid}])
Exemple #2
0
 def test_id(self):
     ceil = resources.CeilometerAlarms()
     ceil.raw_resource = mock.MagicMock()
     self.assertEqual(ceil.raw_resource.alarm_id, ceil.id())