def setUp(self): global _appName self.http = httplib2.Http() self.config = TestConfiguration.create_instance() self.ip = self.config.main.ip self.port = self.config.main.port self.controller = 'Controller1' self.logger = logging.getLogger("WebOperations")
def testRestartability(self): ws = HttpServer(TestConfiguration.create_instance()) self.assertFalse(self._isPortReserved(8888)) thread = threading.Thread(target=ws.start) thread.start() while (not ws.is_running()): time.sleep(0.01) self.assertTrue(self._isPortReserved(8888)) ws.stop() thread.join(10) self.assertFalse(self._isPortReserved(8888))
def testDumpFile(self): fileObj = tempfile.NamedTemporaryFile() fileName = fileObj.name configObj = TestConfiguration.create_instance() Configuration.dump_file(fileName, configObj) loadedCfg = Configuration.load_file(fileName) # comparing cfg and configObj self.assertEquals(sorted(loadedCfg.sections()), sorted(configObj.sections())) configObjDict = {} ConfigFileDict = {} configObjOptions = [] ConfigFileOptions = [] for section in configObj.sections(): secObj = configObj.get_section(section) configObjOptions.extend(secObj.options()) tempOptionsDict = {} for option in secObj.options(): tempOptionsDict[option] = secObj.get_option(option) configObjDict[section] = tempOptionsDict for section in loadedCfg.sections(): secObj = configObj.get_section(section) ConfigFileOptions.extend(secObj.options()) tempOptionsDict = {} for option in secObj.options(): tempOptionsDict[option] = secObj.get_option(option) ConfigFileDict[section] = tempOptionsDict self.assertTrue(configObjOptions) self.assertTrue(ConfigFileOptions) self.assertTrue(ConfigFileDict) self.assertTrue(configObjDict) self.assertEquals(sorted(configObjOptions), sorted(ConfigFileOptions)) self.assertEquals(len(ConfigFileDict), len(configObjDict)) for k, v in configObjDict.iteritems(): self.assertEquals(v, ConfigFileDict[k]) for k, v in ConfigFileDict.iteritems(): self.assertEquals(v, configObjDict[k])
def __init__(self, config=None): self.config = config or TestConfiguration.create_instance() self._rabbitDBBin = os.path.sep.join(['/usr', 'sbin', 'rabbitmq-server']) self._mnesia_base = os.path.sep.join([tempfile.gettempdir(), 'mnesia'])
import sys import os import tasks import test.tasks import model from test.TestConfiguration import TestConfiguration sys.path.insert(0, os.getcwd()) BROKER_HOST = "localhost" BROKER_USER = "******" BROKER_PASSWORD = "******" BROKER_VHOST = "/" CELERYD_CONCURRENCY=1 #CELERY_IMPORTS = ("tasklets.",) ## Using the database to store results # CELERY_RESULT_BACKEND = "database" # CELERY_RESULT_DBURI = "sqlite:///celerydb.sqlite" # Results published as messages (requires AMQP). CELERY_RESULT_BACKEND = "amqp" APPSERVER_CONFIG=None TASKS_PACKAGE=[tasks, test.tasks] #a hack to pass a temporary file name with a generated TestConfiguration config = TestConfiguration.create_instance() MODEL_PACKAGE=model
def __init__(self, config=None): self.config = config or TestConfiguration.create_instance() self._mongoDBBin = os.path.sep.join([os.environ.get("MONGODB_HOME", "/usr"), 'bin', 'mongod']) self._mongoDB = os.path.sep.join([tempfile.gettempdir(), 'mongodb'])
def __init__(self, config=None, projectDir=None): sys.path.insert(0, projectDir) self.config = config or TestConfiguration.create_instance() j25.config = self.config
def __init__(self, config=None): self.config = config or TestConfiguration.create_instance()
def __init__(self, config=None): self.config = config or TestConfiguration.create_instance() self._memCachedIn = os.path.sep.join([os.environ.get("MEMCACHED_HOME", "/usr"), 'bin', 'memcached'])
def setUp(self): self.config = TestConfiguration.create_instance() j25.config = self.config
def __init__(self, config=None): self.config = config or TestConfiguration.create_instance() self.appServer = AppServerFixture(config=self.config) self.mongoDB = MongoDBFixture(config=self.config) # self.rabbitMQ = RabbitMQFixture(config=self.config) self.remoteMemStore = RemoteMemStoreFixture(config=self.config)