Fix some unit tests and bugs
authorJessica Tallon <tsyesika@tsyesika.se>
Mon, 24 Aug 2015 16:28:41 +0000 (18:28 +0200)
committerJessica Tallon <tsyesika@tsyesika.se>
Mon, 24 Aug 2015 19:07:06 +0000 (21:07 +0200)
commitb4997540dcc7b75441e9b10ee6dcac32cc2708be
treee543baf0acc77214c44bad9f826d9187459539a9
parente9bb5879f772e4d546aadb4bb6f935c7c55b8000
Fix some unit tests and bugs

This fixes a lot of the issues with the LocalUser changes that were
merged recently. There was a problem where the attributes of LocalUser
were not being eagerly loaded and because the Session was detached an
exception was being raised when they were accessed.

This also fixes some typo's which were introduced.

Finally this adds a temporary fix for a potential SQLAlchemy bug, this
is a bug where doing:

    User.query.filter(LocalUser.username == "some_username").first()

does NOT yeild a user with the username "some_username" but all users
on the site. The temp fix is to just query the LocalUser, this should
be resolved when bug is confirmed and fixed upstream.
25 files changed:
mediagoblin/api/views.py
mediagoblin/db/migrations.py
mediagoblin/db/mixin.py
mediagoblin/db/models.py
mediagoblin/gmg_commands/addmedia.py
mediagoblin/gmg_commands/batchaddmedia.py
mediagoblin/gmg_commands/users.py
mediagoblin/media_types/blog/views.py
mediagoblin/moderation/tools.py
mediagoblin/moderation/views.py
mediagoblin/plugins/archivalook/tools.py
mediagoblin/plugins/ldap/views.py
mediagoblin/tests/__init__.py
mediagoblin/tests/test_auth.py
mediagoblin/tests/test_basic_auth.py
mediagoblin/tests/test_edit.py
mediagoblin/tests/test_ldap.py
mediagoblin/tests/test_modelmethods.py
mediagoblin/tests/test_moderation.py
mediagoblin/tests/test_openid.py
mediagoblin/tests/test_persona.py
mediagoblin/tests/test_privileges.py
mediagoblin/tests/test_reporting.py
mediagoblin/tests/test_submission.py
mediagoblin/tests/tools.py