aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/tests')
-rw-r--r--mediagoblin/tests/test_auth.py23
-rw-r--r--mediagoblin/tests/test_edit.py12
-rw-r--r--mediagoblin/tests/test_migrations.py4
-rw-r--r--mediagoblin/tests/test_submission.py9
4 files changed, 15 insertions, 33 deletions
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index d3b8caf1..411b4539 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -89,7 +89,6 @@ def test_register_views(test_app):
form = context['register_form']
assert form.username.errors == [u'This field is required.']
assert form.password.errors == [u'This field is required.']
- assert form.confirm_password.errors == [u'This field is required.']
assert form.email.errors == [u'This field is required.']
# Try to register with fields that are known to be invalid
@@ -101,7 +100,6 @@ def test_register_views(test_app):
'/auth/register/', {
'username': 'l',
'password': 'o',
- 'confirm_password': 'o',
'email': 'l'})
context = template.TEMPLATE_TEST_CONTEXT['mediagoblin/auth/register.html']
form = context['register_form']
@@ -125,18 +123,6 @@ def test_register_views(test_app):
assert form.email.errors == [
u'Invalid email address.']
- ## mismatching passwords
- template.clear_test_template_context()
- test_app.post(
- '/auth/register/', {
- 'password': 'herpderp',
- 'confirm_password': 'derpherp'})
- context = template.TEMPLATE_TEST_CONTEXT['mediagoblin/auth/register.html']
- form = context['register_form']
-
- assert form.password.errors == [
- u'Passwords must match.']
-
## At this point there should be no users in the database ;)
assert not mg_globals.database.User.find().count()
@@ -147,7 +133,6 @@ def test_register_views(test_app):
'/auth/register/', {
'username': 'happygirl',
'password': 'iamsohappy',
- 'confirm_password': 'iamsohappy',
'email': 'happygrrl@example.org'})
response.follow()
@@ -227,7 +212,6 @@ def test_register_views(test_app):
'/auth/register/', {
'username': 'happygirl',
'password': 'iamsohappy2',
- 'confirm_password': 'iamsohappy2',
'email': 'happygrrl2@example.org'})
context = template.TEMPLATE_TEST_CONTEXT[
@@ -249,9 +233,9 @@ def test_register_views(test_app):
## Did we redirect to the proper page? Use the right template?
assert_equal(
urlparse.urlsplit(response.location)[2],
- '/auth/forgot_password/email_sent/')
+ '/auth/login/')
assert template.TEMPLATE_TEST_CONTEXT.has_key(
- 'mediagoblin/auth/fp_email_sent.html')
+ 'mediagoblin/auth/login.html')
## Make sure link to change password is sent by email
assert len(mail.EMAIL_TEST_INBOX) == 1
@@ -304,11 +288,10 @@ def test_register_views(test_app):
'/auth/forgot_password/verify/', {
'userid': parsed_get_params['userid'],
'password': 'iamveryveryhappy',
- 'confirm_password': 'iamveryveryhappy',
'token': parsed_get_params['token']})
response.follow()
assert template.TEMPLATE_TEST_CONTEXT.has_key(
- 'mediagoblin/auth/fp_changed_success.html')
+ 'mediagoblin/auth/login.html')
## Verify step 2.2 of password-change works -- login w/ new password success
template.clear_test_template_context()
diff --git a/mediagoblin/tests/test_edit.py b/mediagoblin/tests/test_edit.py
index 0cf71e9b..55f34b42 100644
--- a/mediagoblin/tests/test_edit.py
+++ b/mediagoblin/tests/test_edit.py
@@ -34,12 +34,10 @@ def test_change_password(test_app):
# test that the password can be changed
# template.clear_test_template_context()
test_app.post(
- '/edit/profile/', {
- 'bio': u'',
- 'url': u'',
+ '/edit/account/', {
'old_password': 'toast',
'new_password': '123456',
- 'confirm_password': '123456'})
+ })
# test_user has to be fetched again in order to have the current values
test_user = mg_globals.database.User.one({'username': 'chris'})
@@ -50,12 +48,10 @@ def test_change_password(test_app):
# is wrong
# template.clear_test_template_context()
test_app.post(
- '/edit/profile/', {
- 'bio': u'',
- 'url': u'',
+ '/edit/account/', {
'old_password': 'toast',
'new_password': '098765',
- 'confirm_password': '098765'})
+ })
test_user = mg_globals.database.User.one({'username': 'chris'})
diff --git a/mediagoblin/tests/test_migrations.py b/mediagoblin/tests/test_migrations.py
index e7cef0a1..8e573f5a 100644
--- a/mediagoblin/tests/test_migrations.py
+++ b/mediagoblin/tests/test_migrations.py
@@ -20,10 +20,10 @@ from pymongo import Connection
from mediagoblin.tests.tools import (
install_fixtures_simple, assert_db_meets_expected)
-from mediagoblin.db.util import (
+from mediagoblin.db.mongo.util import (
RegisterMigration, MigrationManager, ObjectId,
MissingCurrentMigration)
-from mediagoblin.db.migrations import add_table_field
+from mediagoblin.db.mongo.migrations import add_table_field
# This one will get filled with local migrations
TEST_MIGRATION_REGISTRY = {}
diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py
index 7c372745..2b17c515 100644
--- a/mediagoblin/tests/test_submission.py
+++ b/mediagoblin/tests/test_submission.py
@@ -1,3 +1,4 @@
+
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011 MediaGoblin contributors. See AUTHORS.
#
@@ -16,6 +17,7 @@
import urlparse
import pkg_resources
+import re
from nose.tools import assert_equal, assert_true, assert_false
@@ -216,7 +218,8 @@ class TestSubmission:
context = template.TEMPLATE_TEST_CONTEXT['mediagoblin/submit/start.html']
form = context['submit_form']
- assert form.file.errors == [u'Invalid file type.']
+ assert re.match(r'^Could not extract any file extension from ".*?"$', str(form.file.errors[0]))
+ assert len(form.file.errors) == 1
# NOTE: The following 2 tests will ultimately fail, but they
# *will* pass the initial form submission step. Instead,
@@ -237,7 +240,7 @@ class TestSubmission:
entry = mg_globals.database.MediaEntry.find_one(
{'title': 'Malicious Upload 2'})
- assert_equal(entry['state'], 'failed')
+ assert_equal(entry.state, 'failed')
assert_equal(
entry['fail_error'],
u'mediagoblin.processing:BadMediaFail')
@@ -257,7 +260,7 @@ class TestSubmission:
entry = mg_globals.database.MediaEntry.find_one(
{'title': 'Malicious Upload 3'})
- assert_equal(entry['state'], 'failed')
+ assert_equal(entry.state, 'failed')
assert_equal(
entry['fail_error'],
u'mediagoblin.processing:BadMediaFail')