def setUp(self):
        self.instance = Mock()
        self.instance.session = Dummy()

        self.component = HealthComponent(20)
        self.component.instance = self.instance
        self.component.initialize()
Exemple #2
0
 def load_module(self, name):
     mod = sys.modules.setdefault(name, Dummy())
     return mod
Exemple #3
0
 def setUp(self):
     self.dummy = Dummy()
     self.validator = Validator()
Exemple #4
0
from run_uh import init_environment
init_environment(True)

import horizons.main
from horizons.constants import UNITS, BUILDINGS, TIER
from horizons.scenario.actions import ACTIONS
from horizons.scenario.conditions import CONDITIONS

db = horizons.main._create_main_db()

# we also need to load entities to get access to the yaml data
from horizons.extscheduler import ExtScheduler
from horizons.component.storagecomponent import StorageComponent
from horizons.entities import Entities
from tests.dummy import Dummy
ExtScheduler.create_instance(Dummy()) # sometimes needed by entities in subsequent calls
Entities.load_buildings(db, load_now=True)
Entities.load_units(load_now=True)

building_name_mapping = dict( (b.id, b.name) for b in Entities.buildings.itervalues() )
unit_name_mapping = dict( (u.id, u.name) for u in Entities.units.itervalues() )

def get_obj_name(obj):
	global db
	if obj < UNITS.DIFFERENCE_BUILDING_UNIT_ID:
		return db("SELECT name FROM building where id = ?", obj)[0][0]
	else:
		return unit_name_mapping[obj]

def get_res_name(res):
	global db
Exemple #5
0
 def setUp(self):
     WorldObject.reset()
     self.session = Dummy()
Exemple #6
0
 def load_module(self, module):
     sys.modules.setdefault(module, Dummy())
init_environment(True)

import horizons.main
from horizons.constants import UNITS, BUILDINGS, TIER
from horizons.scenario.actions import ACTIONS
from horizons.scenario.conditions import CONDITIONS

db = horizons.main._create_main_db()

# we also need to load entities to get access to the yaml data
from horizons.extscheduler import ExtScheduler
from horizons.component.storagecomponent import StorageComponent
from horizons.entities import Entities
from tests.dummy import Dummy
ExtScheduler.create_instance(
    Dummy())  # sometimes needed by entities in subsequent calls
Entities.load_buildings(db, load_now=True)
Entities.load_units(load_now=True)

building_name_mapping = dict(
    (b.id, b.name) for b in Entities.buildings.itervalues())
unit_name_mapping = dict((u.id, u.name) for u in Entities.units.itervalues())


def get_obj_name(obj):
    global db
    if obj < UNITS.DIFFERENCE_BUILDING_UNIT_ID:
        return db("SELECT name FROM building where id = ?", obj)[0][0]
    else:
        return unit_name_mapping[obj]
Exemple #8
0
 def setUp(self):
     self.session = Dummy()