Revision 5dbfa80d
Remplacement des fichiers de configuration Python (settings.py) en fichiers INI (settings.ini), resp. pour les settings de test.
Correction des dépendances entre les composants (vigiboard -> vigilo.turbogears -> vigilo.models) et sur les bibliothèques.
Réintégration de la configuration de SQLAlchemy dans les fichiers INI de Turbogears.
Mise à jour de la configuration du corrélateur à titre d'exemple.
La manière de configurer les loggers a RADICALEMENT changée !! Lisez les settings du corrélateur pour un exemple.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@1866 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/tests/__init__.py | ||
---|---|---|
12 | 12 |
import nose |
13 | 13 |
from nose.tools import eq_, nottest |
14 | 14 |
|
15 |
from vigilo.models.vigilo_bdd_config import metadata |
|
16 |
from vigilo.models.session import DBSession |
|
15 |
from vigilo.models.configure import metadata, DBSession |
|
17 | 16 |
|
18 | 17 |
__all__ = ['setup_db', 'teardown_db', 'TestController', 'url_for'] |
19 | 18 |
|
20 |
metadata.bind = DBSession.bind |
|
21 |
|
|
22 | 19 |
def setup_db(): |
23 | 20 |
"""Method used to build a database""" |
24 |
metadata.create_all() |
|
21 |
print "Creating model" |
|
22 |
engine = config['pylons.app_globals'].sa_engine |
|
23 |
metadata.create_all(engine) |
|
25 | 24 |
|
26 | 25 |
def teardown_db(): |
27 | 26 |
"""Method used to destroy a database""" |
28 |
metadata.drop_all() |
|
29 |
|
|
27 |
print "Destroying model" |
|
28 |
engine = config['pylons.app_globals'].sa_engine |
|
29 |
metadata.drop_all(engine) |
|
30 | 30 |
|
31 | 31 |
class TestController(object): |
32 | 32 |
""" |
... | ... | |
53 | 53 |
def setUp(self): |
54 | 54 |
"""Method called by nose before running each test""" |
55 | 55 |
# Loading the application: |
56 |
setup_db() |
|
56 | 57 |
conf_dir = config.here |
57 |
wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test,
|
|
58 |
relative_to=conf_dir)
|
|
58 |
wsgiapp = loadapp('config:test.ini#%s' % |
|
59 |
self.application_under_test, relative_to=conf_dir)
|
|
59 | 60 |
self.app = TestApp(wsgiapp) |
60 | 61 |
# Setting it up: |
61 | 62 |
test_file = path.join(conf_dir, 'test.ini') |
Also available in: Unified diff