diff options
author | Jessica Tallon <tsyesika@tsyesika.se> | 2015-07-17 17:51:51 +0200 |
---|---|---|
committer | Jessica Tallon <tsyesika@tsyesika.se> | 2015-07-31 15:15:24 +0200 |
commit | d88fcb03e2e520da6a7d0203d660e4536108f56b (patch) | |
tree | 75b751fae15a037301bb384e64eba13746cb57a6 /mediagoblin/tests/tools.py | |
parent | 283e6d8b9f09341e3b97418b79f389bfdfee6498 (diff) | |
download | mediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.tar.lz mediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.tar.xz mediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.zip |
Change codebase to query or create correct User model
The code base had many references to User.username and other
specific to LocalUser attributes as that was the way it use to exist.
This updates those to query on the generic User model but filtering
by attributes on the LocalUser.
Diffstat (limited to 'mediagoblin/tests/tools.py')
-rw-r--r-- | mediagoblin/tests/tools.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mediagoblin/tests/tools.py b/mediagoblin/tests/tools.py index dec95e83..76b7983a 100644 --- a/mediagoblin/tests/tools.py +++ b/mediagoblin/tests/tools.py @@ -25,7 +25,7 @@ from paste.deploy import loadapp from webtest import TestApp from mediagoblin import mg_globals -from mediagoblin.db.models import User, MediaEntry, Collection, MediaComment, \ +from mediagoblin.db.models import User, LocalUser, MediaEntry, Collection, MediaComment, \ CommentSubscription, CommentNotification, Privilege, CommentReport, Client, \ RequestToken, AccessToken, Activity, Generator from mediagoblin.tools import testing @@ -176,9 +176,9 @@ def assert_db_meets_expected(db, expected): def fixture_add_user(username=u'chris', password=u'toast', privileges=[], wants_comment_notification=True): # Reuse existing user or create a new one - test_user = User.query.filter_by(username=username).first() + test_user = User.query.filter(LocalUser.username==username).first() if test_user is None: - test_user = User() + test_user = LocalUser() test_user.username = username test_user.email = username + u'@example.com' if password is not None: @@ -191,7 +191,7 @@ def fixture_add_user(username=u'chris', password=u'toast', test_user.save() # Reload - test_user = User.query.filter_by(username=username).first() + test_user = User.query.filter(LocalUser.username==username).first() # ... and detach from session: Session.expunge(test_user) |