[test] update to deal with dicts instead of mock entities
This is all client side where we no longer have an orm.
--- a/test/unittest_task.py Wed Jan 16 20:27:33 2013 +0100
+++ b/test/unittest_task.py Wed Aug 07 12:41:59 2013 +0200
@@ -47,55 +47,37 @@
repo=None, environment=None):
pps = preprocessors
repo = repo or MOCKREPO
- environment = environment or Environment(eid=tconfig.name, apycot_preprocessors={})
- texec = mock_object(configuration=tconfig, environment=environment,
- branch=environment.conf.get('branch'),
- options_dict=lambda self:{})
+ environment = environment or Environment(eid=tconfig['name'], apycot_preprocessors={})
+ texec = dict(configuration=tconfig, environment=environment,
+ branch=environment['apycot_configuration'].get('branch'),
+ options='')
test = BaseTest(texec, writer)
if pps is not None:
test.apycot_preprocessors = lambda x: pps
if checkers is not None:
test.checkers = checkers
if repo is not None:
- test._repositories[environment.eid] = repo
+ test._repositories[environment['eid']] = repo
return test
-class TestConfig:
+class TestConfig(dict):
def __init__(self, name, dependencies=(), environ=None, conf=None):
- self.name = self.eid = name
- #self._repo = repo
- self._dependencies = dependencies
- self._environ = environ or {'ZIGUOUIGOUI': 'YOOOO'}
- self.all_checks = ()
- if conf is None:
- conf = {}
- self._configuration = conf
+ super(TestConfig, self).__init__()
+ self['name'] = self['eid'] = name
+ self['apycot_process_environment'] = environ or {'ZIGUOUIGOUI': 'YOOOO'}
- def apycot_process_environment(self):
- return self._environ
- def apycot_configuration(self, pe):
- return self._configuration.copy()
- def dependencies(self):
- return self._dependencies
-class Environment(object):
+class Environment(dict):
def __init__(self, eid, apycot_preprocessors={},
- repository=MockVCSFile('mercurial',
- source_url='http://bob.org/hg/toto/'),
+ repository='default',
conf=None):
- self.eid = eid
- self.apycot_preprocessors = apycot_preprocessors
- self.repository = repository
- if conf is None:
- conf = {}
- self.conf = conf
- self.name=''
- self.vcs_path = ''
-
- def apycot_configuration(self):
- return self.conf
- def apycot_process_environment(self):
- return {}
+ if repository is 'default':
+ repository = dict(type='mercurial', source_url='http://bob.org/hg/toto/', path='')
+ super(Environment, self).__init__(
+ eid=eid, name='', vcs_path='',
+ apycot_configuration=conf or {},
+ apycot_process_environment={},
+ repository=repository)
def dc_title(self):
return self.name
--- a/test/utils.py Wed Jan 16 20:27:33 2013 +0100
+++ b/test/utils.py Wed Aug 07 12:41:59 2013 +0200
@@ -91,12 +91,10 @@
return self._apycot_config
-class MockVCSFile:
+class MockVCSFile(dict):
def __init__(self, _type, source_url=None, path=None):
- self.source_url = source_url
- self.path = path
- self.type = _type
- self.local_cache = None
+ super(MockVCSFile, self).__init__(
+ type=_type, source_url=source_url, path=path, local_cache=None)
class MockRepository: