From 5c2ece7401723486d76ea0fcd2f99ba4d1002504 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 4 Apr 2013 19:23:04 -0500 Subject: Switch test_app generation over to use py.test fixtures. By doing this, we can take advantage of py.test's ability to create temporary directories that are then cleaned up later during testing. This helps for sandboxing things. This also involves a ton of changes: - Changing the get_app stuff appropriately, getting rid of the setup_fresh_app decorator - Making said fixture - Switching over a billion tests to use it --- mediagoblin/tests/test_misc.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'mediagoblin/tests/test_misc.py') diff --git a/mediagoblin/tests/test_misc.py b/mediagoblin/tests/test_misc.py index b20262cf..7143938e 100644 --- a/mediagoblin/tests/test_misc.py +++ b/mediagoblin/tests/test_misc.py @@ -18,18 +18,15 @@ from nose.tools import assert_equal from mediagoblin.db.base import Session from mediagoblin.db.models import User, MediaEntry, MediaComment -from mediagoblin.tests.tools import get_app, \ - fixture_add_user, fixture_media_entry +from mediagoblin.tests.tools import fixture_add_user, fixture_media_entry -def test_404_for_non_existent(): - test_app = get_app(dump_old_app=False) +def test_404_for_non_existent(test_app): res = test_app.get('/does-not-exist/', expect_errors=True) assert_equal(res.status_int, 404) -def test_user_deletes_other_comments(): - get_app() # gotta init the db and etc +def test_user_deletes_other_comments(test_app): user_a = fixture_add_user(u"chris_a") user_b = fixture_add_user(u"chris_b") @@ -81,8 +78,7 @@ def test_user_deletes_other_comments(): assert_equal(cmt_cnt2, cmt_cnt1 - 4) -def test_media_deletes_broken_attachment(): - get_app() # gotta init the db and etc +def test_media_deletes_broken_attachment(test_app): user_a = fixture_add_user(u"chris_a") media = fixture_media_entry(uploader=user_a.id, save=False) -- cgit v1.2.3