| Conditions | 3 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import pytest |
||
| 7 | @pytest.fixture() |
||
| 8 | def testapp(request): |
||
| 9 | app = create_app('sugarloaf.settings.TestConfig') |
||
| 10 | client = app.test_client() |
||
| 11 | |||
| 12 | db.app = app |
||
| 13 | db.create_all() |
||
| 14 | |||
| 15 | if getattr(request.module, "create_user", True): |
||
| 16 | admin = User('admin', 'supersafepassword') |
||
| 17 | db.session.add(admin) |
||
| 18 | db.session.commit() |
||
| 19 | |||
| 20 | def teardown(): |
||
| 21 | db.session.remove() |
||
| 22 | db.drop_all() |
||
| 23 | |||
| 24 | request.addfinalizer(teardown) |
||
| 25 | |||
| 26 | return client |
||
| 27 |