def handle(self, *args, **options): # engine was created by initial_data.yml my_engine = Engine.objects.get(version='2.4.10', engine_type__name='mongodb') my_host = factory.HostFactory(hostname='localhost') my_env = factory.EnvironmentFactory(name='laboratory') my_plan = factory.PlanFactory(name='small', engine_type=my_engine.engine_type, environments=[my_env]) my_infradb = factory.DatabaseInfraFactory(name='local_infra', plan=my_plan, environment=my_env, engine=my_engine, capacity=10) factory.InstanceFactory(databaseinfra=my_infradb, hostname=my_host) my_role = Role.objects.get_or_create(name="role_dba")[0] organization = Organization.objects.get_or_create( name='fake_organization')[0] my_team = Team.objects.get_or_create(name="my team", role=my_role, organization=organization)[0] my_admin = User.objects.create_superuser('admin', email='*****@*****.**', password='******') my_team.users.add(my_admin)
def _create_database(self, env_name='fake_env', infra_name='__test__ mysqlinfra2'): environment = factory_physical.EnvironmentFactory( name=env_name ) databaseinfra = factory_physical.DatabaseInfraFactory( name=infra_name, user="******", password='******', engine=self.engine, plan=self.plan, ssl_configured=True, environment=environment ) hostname = factory_physical.HostFactory( ssl_expire_at=FAKE_TODAY + timedelta(days=16) ) self.instance_helper.create_instances_by_quant( instance_type=Instance.MYSQL, qt=1, infra=databaseinfra, hostname=hostname ) database = factory_logical.DatabaseFactory( name='test_db_1', databaseinfra=databaseinfra, ) return environment, databaseinfra, hostname, database
def setUp(self): self.instance = physical_factory.InstanceFactory() self.databaseinfra = self.instance.databaseinfra self.engine = FakeDriver(databaseinfra=self.databaseinfra) self.environment = physical_factory.EnvironmentFactory() self.plan_upgrade = physical_factory.PlanFactory()