def test_list(self, mock_manager): ceil = resources.CeilometerAlarms() ceil.tenant_uuid = mock.MagicMock() mock_manager().list.return_value = ["a", "b", "c"] mock_manager.reset_mock() self.assertEqual(["a", "b", "c"], ceil.list()) mock_manager().list.assert_called_once_with( q=[{"field": "project_id", "op": "eq", "value": ceil.tenant_uuid}])
def test_id(self): ceil = resources.CeilometerAlarms() ceil.raw_resource = mock.MagicMock() self.assertEqual(ceil.raw_resource.alarm_id, ceil.id())