Revert "Fix other tests"

This reverts commit 54963e9f91.
This commit is contained in:
Evarin 2018-04-23 00:35:57 +02:00
parent 54963e9f91
commit 1142db73f7
2 changed files with 19 additions and 24 deletions

View file

@ -8,23 +8,23 @@ User = get_user_model()
class ClipperProviderTests(CASTestCase):
def setUp(self):
pass
self.u = User.objects.create_user('user', 'user@mail.net', 'user')
def test_auto_signup(self):
self.client_cas_login(
self.client, provider_id='clipper', username='clipperuid')
self.client, provider_id='clipper', username='clipper_uid')
u = User.objects.get(username__contains='clipperuid')
self.assertEqual(u.email, 'clipperuid@clipper.ens.fr')
u = User.objects.get(username='clipper_uid')
self.assertEqual(u.email, 'clipper_uid@clipper.ens.fr')
class ClipperViewsTests(CASViewTestCase):
def test_login_view(self):
r = self.client.get('/account/clipper/login/')
r = self.client.get('/accounts/clipper/login/')
expected = (
"https://cas.eleves.ens.fr/login?service=http%3A%2F%2Ftestserver"
"%2Faccount%2Fclipper%2Flogin%2Fcallback%2F"
"%2Faccounts%2Fclipper%2Flogin%2Fcallback%2F"
)
self.assertRedirects(
r, expected,
@ -33,20 +33,20 @@ class ClipperViewsTests(CASViewTestCase):
def test_callback_view(self):
# Required to initialize a SocialLogin.
r = self.client.get('/account/clipper/login/')
r = self.client.get('/accounts/clipper/login/')
# Tests.
self.patch_cas_response(valid_ticket='__all__')
r = self.client.get('/account/clipper/login/callback/', {
r = self.client.get('/accounts/clipper/login/callback/', {
'ticket': '123456',
})
self.assertLoginSuccess(r, "/user/")
self.assertLoginSuccess(r)
def test_logout_view(self):
r = self.client.get('/account/clipper/logout/')
r = self.client.get('/accounts/clipper/logout/')
expected = (
"https://cas.eleves.ens.fr/logout?service=http%3A%2F%2Ftestserver"
"%2Fview%2F"
"%2F"
)
self.assertRedirects(
r, expected,

View file

@ -38,17 +38,12 @@ def prevent_logout_pwd_change(client, user):
session[HASH_SESSION_KEY] = user.get_session_auth_hash()
session.save()
"""
class ViewsTests(TestCase):
"""
""
Checks (barely) that templates do not contain errors.
"""
""
def setUp(self):
try:
self.u = User.objects.get(username="user")
self.u.email = "user@mail.net"
self.u.save()
except User.DoesNotExist:
self.u = User.objects.create_user('user', 'user@mail.net', 'user')
Site.objects.filter(pk=1).update(domain='testserver')
@ -60,14 +55,14 @@ class ViewsTests(TestCase):
def _get_confirm_email_link(self, email_msg):
m = re.search(
r'http://testserver(/account/confirm-email/.*/)',
r'http://testserver(/accounts/confirm-email/.*/)',
email_msg.body,
)
return m.group(1)
def _get_reset_password_link(self, email_msg):
m = re.search(
r'http://testserver(/account/password/reset/key/.*/)',
r'http://testserver(/accounts/password/reset/key/.*/)',
email_msg.body,
)
return m.group(1)
@ -151,7 +146,7 @@ class ViewsTests(TestCase):
def test_account_reset_password_from_key_done(self):
r = self.client.get(reverse('account_reset_password_from_key_done'))
self.assertEqual(r.status_code, 200)
"""
class LongTermClipperTests(CASTestCase):