Remove the try-catch block here. It isn't needed.
[xonotic/xonstat.git] / xonstat / tests.py
1 import unittest
2 from pyramid.config import Configurator
3 from pyramid import testing
4
5 def _initTestingDB():
6     from sqlalchemy import create_engine
7     from xonstat.models import initialize_sql
8     session = initialize_sql(create_engine('sqlite://'))
9     return session
10
11 class TestMyView(unittest.TestCase):
12     def setUp(self):
13         self.config = testing.setUp()
14         _initTestingDB()
15
16     def tearDown(self):
17         testing.tearDown()
18
19     def test_it(self):
20         from xonstat.views import my_view
21         request = testing.DummyRequest()
22         info = my_view(request)
23         self.assertEqual(info['root'].name, 'root')
24         self.assertEqual(info['project'], 'XonStat')