diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-12-01 23:33:47 +0100 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-12-01 23:33:47 +0100 |
commit | 9754802d4bca036b8fb0b50db948dd2eb8f64bd6 (patch) | |
tree | f641c782ec9381fa075d80cf9d8e86f0a4c6095e /mediagoblin/tests/test_submission.py | |
parent | 72567762e36c849ffe8172b6cea4ca1be682e511 (diff) | |
download | mediagoblin-9754802d4bca036b8fb0b50db948dd2eb8f64bd6.tar.lz mediagoblin-9754802d4bca036b8fb0b50db948dd2eb8f64bd6.tar.xz mediagoblin-9754802d4bca036b8fb0b50db948dd2eb8f64bd6.zip |
fixture_add_user: Factoring a unit test tool
Some unit tests need a user in the database, especially to
act as that user. Some routines did that on their own. So
factored this whole thing into a new function and use it
around.
Diffstat (limited to 'mediagoblin/tests/test_submission.py')
-rw-r--r-- | mediagoblin/tests/test_submission.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index eea5747f..7ea6c4bc 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -19,8 +19,8 @@ import pkg_resources from nose.tools import assert_equal, assert_true, assert_false -from mediagoblin.auth import lib as auth_lib -from mediagoblin.tests.tools import setup_fresh_app, get_test_app +from mediagoblin.tests.tools import setup_fresh_app, get_test_app, \ + fixture_add_user from mediagoblin import mg_globals from mediagoblin.tools import template, common @@ -45,13 +45,7 @@ class TestSubmission: # TODO: Possibly abstract into a decorator like: # @as_authenticated_user('chris') - test_user = mg_globals.database.User() - test_user['username'] = u'chris' - test_user['email'] = u'chris@example.com' - test_user['email_verified'] = True - test_user['status'] = u'active' - test_user['pw_hash'] = auth_lib.bcrypt_gen_password_hash('toast') - test_user.save() + test_user = fixture_add_user() self.test_user = test_user |