def get_fake_instances_data(request): import json from novaclient.v1_1.servers import Server, ServerManager from horizon.api.nova import Server as HServer instances = [HServer(Server(ServerManager(None), i), request) for i in json.loads(test_json)] for i in instances: i._loaded = True instances += instances return instances
from novaclient.v1_1.servers import ServerManager from novaclient.v1_1.servers import Server from keystone_wrapper.client import KeystoneClient from notifications.tests import get_stub_keystone_client from notifications.notification_sender import Notifications from thresholds.models import PassedThreshold from thresholds.models import Threshold from thresholds.event_handlers import StopProjectInstancesThresholdAction from thresholds.balance_thresholds import ActionQueueProcessor from thresholds.balance_thresholds import ThresholdActionBase my_tenant_id = 1 other_tenant_id = 2 instance_list = [ Server(None, { 'name': 'ser1', 'tenant_id': my_tenant_id }), Server(None, { 'name': 'ser2', 'tenant_id': other_tenant_id }), Server(None, { 'name': 'ser3', 'tenant_id': my_tenant_id }), Server(None, { 'name': 'ser4', 'tenant_id': other_tenant_id }) ]