From 4d6f8cb07964f283111a06b42b49fc77fb1c730b Mon Sep 17 00:00:00 2001 From: wookey Date: Mon, 7 Oct 2013 23:45:59 +0100 Subject: [PATCH] Document 'cavesnew' option in databasereset.py - which just reads in caves datafiles. --- databaseReset.py | 4 +++- registration/tests.py | 38 +++++++++----------------------------- registration/views.py | 4 ++-- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/databaseReset.py b/databaseReset.py index 9e6aa06..ee2cac1 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -167,12 +167,14 @@ def usage(): where command is: reset - this is normal usage, clear database and reread everything desc + cavesnew - read in the caves logbooks - read in the logbooks autologbooks dumplogbooks + people QMs - read in the QM files resetend - scans - reaq in the scanned surveynotes + scans - read in the scanned surveynotes survex - read in the survex files survexpos tunnel - read in the Tunnel files diff --git a/registration/tests.py b/registration/tests.py index df6bb2d..e6ac44c 100644 --- a/registration/tests.py +++ b/registration/tests.py @@ -197,8 +197,7 @@ class RegistrationFormTests(RegistrationTestCase): 'data': { 'username': 'foo/bar', 'email': 'foo@example.com', - 'password1': 'foo', - 'password2': 'foo' }, + 'password1': 'foo' }, 'error': ('username', [u"Enter a valid value."]) }, @@ -207,21 +206,10 @@ class RegistrationFormTests(RegistrationTestCase): 'data': { 'username': 'alice', 'email': 'alice@example.com', - 'password1': 'secret', - 'password2': 'secret' }, + 'password1': 'secret' }, 'error': ('username', [u"This username is already taken. Please choose another."]) }, - # Mismatched passwords. - { - 'data': - { 'username': 'foo', - 'email': 'foo@example.com', - 'password1': 'foo', - 'password2': 'bar' }, - 'error': - ('__all__', [u"You must type the same password each time"]) - }, ] for invalid_dict in invalid_data_dicts: @@ -231,8 +219,7 @@ class RegistrationFormTests(RegistrationTestCase): form = forms.RegistrationForm(data={ 'username': 'foo', 'email': 'foo@example.com', - 'password1': 'foo', - 'password2': 'foo' }) + 'password1': 'foo' }) self.failUnless(form.is_valid()) def test_registration_form_tos(self): @@ -243,15 +230,13 @@ class RegistrationFormTests(RegistrationTestCase): """ form = forms.RegistrationFormTermsOfService(data={ 'username': 'foo', 'email': 'foo@example.com', - 'password1': 'foo', - 'password2': 'foo' }) + 'password1': 'foo' }) self.failIf(form.is_valid()) self.assertEqual(form.errors['tos'], [u"You must agree to the terms to register"]) form = forms.RegistrationFormTermsOfService(data={ 'username': 'foo', 'email': 'foo@example.com', 'password1': 'foo', - 'password2': 'foo', 'tos': 'on' }) self.failUnless(form.is_valid()) @@ -263,15 +248,13 @@ class RegistrationFormTests(RegistrationTestCase): """ form = forms.RegistrationFormUniqueEmail(data={ 'username': 'foo', 'email': 'alice@example.com', - 'password1': 'foo', - 'password2': 'foo' }) + 'password1': 'foo' }) self.failIf(form.is_valid()) self.assertEqual(form.errors['email'], [u"This email address is already in use. Please supply a different email address."]) form = forms.RegistrationFormUniqueEmail(data={ 'username': 'foo', 'email': 'foo@example.com', - 'password1': 'foo', - 'password2': 'foo' }) + 'password1': 'foo' }) self.failUnless(form.is_valid()) def test_registration_form_no_free_email(self): @@ -281,8 +264,7 @@ class RegistrationFormTests(RegistrationTestCase): """ base_data = { 'username': 'foo', - 'password1': 'foo', - 'password2': 'foo' } + 'password1': 'foo' } for domain in ('aim.com', 'aol.com', 'email.com', 'gmail.com', 'googlemail.com', 'hotmail.com', 'hushmail.com', 'msn.com', 'mail.ru', 'mailinator.com', 'live.com'): @@ -312,8 +294,7 @@ class RegistrationViewTests(RegistrationTestCase): response = self.client.post(reverse('registration_register'), data={ 'username': 'alice', # Will fail on username uniqueness. 'email': 'foo@example.com', - 'password1': 'foo', - 'password2': 'foo' }) + 'password1': 'foo' }) self.assertEqual(response.status_code, 200) self.failUnless(response.context['form']) self.failUnless(response.context['form'].errors) @@ -321,8 +302,7 @@ class RegistrationViewTests(RegistrationTestCase): response = self.client.post(reverse('registration_register'), data={ 'username': 'foo', 'email': 'foo@example.com', - 'password1': 'foo', - 'password2': 'foo' }) + 'password1': 'foo' }) self.assertEqual(response.status_code, 302) self.assertEqual(response['Location'], 'http://testserver%s' % reverse('registration_complete')) self.assertEqual(RegistrationProfile.objects.count(), 3) diff --git a/registration/views.py b/registration/views.py index 8228fa9..d42c4c0 100644 --- a/registration/views.py +++ b/registration/views.py @@ -81,7 +81,7 @@ def activate(request, activation_key, context[key] = callable(value) and value() or value return render_to_response(template_name, c.update({ 'account': account, - 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'settings':settings}), + 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'settings': settings, }), context_instance=context,) @@ -166,5 +166,5 @@ def register(request, success_url=None, for key, value in extra_context.items(): context[key] = callable(value) and value() or value return render_to_response(template_name, - c.update({ 'form': form,'settings':settings }), + c.update({ 'form': form, 'settings': settings, }), context_instance=context)