Skip to content

Commit

Permalink
Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
wunki committed Oct 14, 2013
1 parent 999fedd commit 09b43dc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ case $1 in
umessages ) echo -e "\033[1mRunning tests for umessages.\033[0m"
cmd="demo/manage.py test umessages"
;;
* ) echo -e "\033[1mRunning all tests.\033[0m"
cmd="demo/manage.py test userena umessages"
* ) echo -e "\033[1mRunning tests for userena.\033[0m"
cmd="demo/manage.py test userena"
esac

$cmd
2 changes: 1 addition & 1 deletion userena/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_get_mugshot_url_with_gravatar(self):
Test if the correct mugshot is returned when the user makes use of gravatar.
"""
template = 'http://www.gravatar.com/avatar/%(hash)s?s=%(size)s&d=%(default)s'
template = '//www.gravatar.com/avatar/%(hash)s?s=%(size)s&d=%(default)s'
profile = Profile.objects.get(pk=1)

gravatar_hash = hashlib.md5(profile.user.email).hexdigest()
Expand Down
14 changes: 1 addition & 13 deletions userena/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class UtilsTests(TestCase):
fixtures = ['users']

def test_get_gravatar(self):
template = 'http://www.gravatar.com/avatar/%(hash)s?s=%(size)s&d=%(type)s'
template = '//www.gravatar.com/avatar/%(hash)s?s=%(size)s&d=%(type)s'

# The hash for [email protected]
hash = hashlib.md5('[email protected]').hexdigest()
Expand Down Expand Up @@ -42,18 +42,6 @@ def test_get_gravatar(self):
response = self.client.get(http_404)
self.failUnlessEqual(response.status_code, 404)

# Test the switch to HTTPS
userena_settings.USERENA_MUGSHOT_GRAVATAR_SECURE = True

template = 'https://secure.gravatar.com/avatar/%(hash)s?s=%(size)s&d=%(type)s'
self.failUnlessEqual(get_gravatar('[email protected]'),
template % {'hash': hash,
'size': 80,
'type': 'identicon'})

# And set back to default
userena_settings.USERENA_MUGSHOT_GRAVATAR_SECURE = False

def test_signin_redirect(self):
"""
Test redirect function which should redirect the user after a
Expand Down
6 changes: 5 additions & 1 deletion userena/tests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_retry_activation_ask(self):

# We must reload the object from database to get the new key
user = User.objects.get(email='[email protected]')
self.assertContains(response, "Account re-activation succeded")
self.assertContains(response, "Account re-activation succeeded")

self.failIfEqual(old_key, user.userena_signup.activation_key)
user = User.objects.get(email='[email protected]')
Expand Down Expand Up @@ -129,6 +129,10 @@ def test_invalid_confirmation(self):

def test_disabled_view(self):
""" A ``GET`` to the ``disabled`` view """
response = self.client.get(reverse('userena_disabled',
kwargs={'username': 'john'}))
self.assertEqual(response.status_code, 404)
u = User.objects.filter(username='john').update(is_active=False)
response = self.client.get(reverse('userena_disabled',
kwargs={'username': 'john'}))
self.assertEqual(response.status_code, 200)
Expand Down

0 comments on commit 09b43dc

Please sign in to comment.