From a60efa2941617424258bfbd89bc5fa9f46048d90 Mon Sep 17 00:00:00 2001 From: Agrendalath Date: Mon, 14 Oct 2019 13:24:50 +0200 Subject: [PATCH] Make tests more static --- common/djangoapps/student/tests/test_admin_views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/djangoapps/student/tests/test_admin_views.py b/common/djangoapps/student/tests/test_admin_views.py index 1ba2681ab1..59429b254c 100644 --- a/common/djangoapps/student/tests/test_admin_views.py +++ b/common/djangoapps/student/tests/test_admin_views.py @@ -324,9 +324,9 @@ class LoginFailuresAdminTest(TestCase): """Setup.""" super(LoginFailuresAdminTest, self).setUp() self.client.login(username=self.user.username, password='test') - user = UserFactory.create() + self.user2 = UserFactory.create() LoginFailures.objects.create(user=self.user, failure_count=10, lockout_until=datetime.datetime.now()) - LoginFailures.objects.create(user=user, failure_count=2) + LoginFailures.objects.create(user=self.user2, failure_count=2) def tearDown(self): """Tear Down.""" @@ -339,8 +339,9 @@ class LoginFailuresAdminTest(TestCase): It shouldn't raise `TypeError`. """ try: - map(str, LoginFailures.objects.all()) - except TypeError, e: + str(LoginFailures.objects.get(user=self.user)) + str(LoginFailures.objects.get(user=self.user2)) + except TypeError as e: self.fail("Failed executing `__str__` with unicode: {0}".format(e)) @ddt.data(