diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-11-13 19:25:06 +0100 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-11-15 11:32:13 +0100 |
commit | eabe6b678a98fd06d9cd8463935a3b842f41485c (patch) | |
tree | 9d8115df0629a5bbc9842c1616fed466371539e7 /mediagoblin/tests | |
parent | 7cbddc96a85410c14583b598312e40efe6051a44 (diff) | |
download | mediagoblin-eabe6b678a98fd06d9cd8463935a3b842f41485c.tar.lz mediagoblin-eabe6b678a98fd06d9cd8463935a3b842f41485c.tar.xz mediagoblin-eabe6b678a98fd06d9cd8463935a3b842f41485c.zip |
Dot-Notation for "_id"
Note: Migrations can't use "Dot Notation"!
Migrations run on pymongo, not mongokit.
So they can't use the "Dot Notation".
This isn't really a big issue, as migrations are anyway
quite mongo specific.
Diffstat (limited to 'mediagoblin/tests')
-rw-r--r-- | mediagoblin/tests/test_auth.py | 12 | ||||
-rw-r--r-- | mediagoblin/tests/test_submission.py | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index 40961eca..153c6e53 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -168,7 +168,7 @@ def test_register_views(test_app): ## Make sure user is logged in request = template.TEMPLATE_TEST_CONTEXT[ 'mediagoblin/user_pages/user.html']['request'] - assert request.session['user_id'] == unicode(new_user['_id']) + assert request.session['user_id'] == unicode(new_user._id) ## Make sure we get email confirmation, and try verifying assert len(mail.EMAIL_TEST_INBOX) == 1 @@ -185,7 +185,7 @@ def test_register_views(test_app): ### user should have these same parameters assert parsed_get_params['userid'] == [ - unicode(new_user['_id'])] + unicode(new_user._id)] assert parsed_get_params['token'] == [ new_user['verification_key']] @@ -193,7 +193,7 @@ def test_register_views(test_app): template.clear_test_template_context() response = test_app.get( "/auth/verify_email/?userid=%s&token=total_bs" % unicode( - new_user['_id'])) + new_user._id)) response.follow() context = template.TEMPLATE_TEST_CONTEXT[ 'mediagoblin/user_pages/user.html'] @@ -269,7 +269,7 @@ def test_register_views(test_app): # user should have matching parameters new_user = mg_globals.database.User.find_one({'username': 'happygirl'}) - assert parsed_get_params['userid'] == [unicode(new_user['_id'])] + assert parsed_get_params['userid'] == [unicode(new_user._id)] assert parsed_get_params['token'] == [new_user['fp_verification_key']] ### The forgotten password token should be set to expire in ~ 10 days @@ -280,7 +280,7 @@ def test_register_views(test_app): template.clear_test_template_context() response = test_app.get( "/auth/forgot_password/verify/?userid=%s&token=total_bs" % unicode( - new_user['_id']), status=400) + new_user._id), status=400) assert response.status == '400 Bad Request' ## Try using an expired token to change password, shouldn't work @@ -412,7 +412,7 @@ def test_authentication_views(test_app): # Make sure user is in the session context = template.TEMPLATE_TEST_CONTEXT['mediagoblin/root.html'] session = context['request'].session - assert session['user_id'] == unicode(test_user['_id']) + assert session['user_id'] == unicode(test_user._id) # Successful logout # ----------------- diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index 1c657e6c..dec7118b 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -177,7 +177,7 @@ class TestSubmission: request.urlgen('mediagoblin.user_pages.media_confirm_delete', # No work: user=media.uploader().username, user=self.test_user['username'], - media=media['_id']), + media=media._id), # no value means no confirm {}) @@ -197,7 +197,7 @@ class TestSubmission: request.urlgen('mediagoblin.user_pages.media_confirm_delete', # No work: user=media.uploader().username, user=self.test_user['username'], - media=media['_id']), + media=media._id), {'confirm': 'y'}) response.follow() @@ -208,7 +208,7 @@ class TestSubmission: # Does media entry still exist? assert_false( request.db.MediaEntry.find( - {'_id': media['_id']}).count()) + {'_id': media._id}).count()) def test_malicious_uploads(self): # Test non-suppoerted file with non-supported extension |