Browse Source

Replace user_1/user_2 with user and other_user

rafalp 6 years ago
parent
commit
f86f674858

+ 4 - 4
misago/readtracker/tests/test_clearreadtracker.py

@@ -15,8 +15,8 @@ from misago.users.testutils import create_test_user
 
 
 class ClearReadTrackerTests(TestCase):
 class ClearReadTrackerTests(TestCase):
     def setUp(self):
     def setUp(self):
-        self.user_1 = create_test_user("User1", "user1@example.com")
-        self.user_2 = create_test_user("User2", "user2@example.com")
+        self.user = create_test_user("User", "user@example.com")
+        self.other_user = create_test_user("OtherUser", "otheruser@example.com")
 
 
         self.category = Category.objects.get(slug="first-category")
         self.category = Category.objects.get(slug="first-category")
 
 
@@ -35,7 +35,7 @@ class ClearReadTrackerTests(TestCase):
         thread = testutils.post_thread(self.category)
         thread = testutils.post_thread(self.category)
 
 
         existing = PostRead.objects.create(
         existing = PostRead.objects.create(
-            user=self.user_1,
+            user=self.user,
             category=self.category,
             category=self.category,
             thread=thread,
             thread=thread,
             post=thread.first_post,
             post=thread.first_post,
@@ -43,7 +43,7 @@ class ClearReadTrackerTests(TestCase):
             - timedelta(days=settings.MISAGO_READTRACKER_CUTOFF / 4),
             - timedelta(days=settings.MISAGO_READTRACKER_CUTOFF / 4),
         )
         )
         deleted = PostRead.objects.create(
         deleted = PostRead.objects.create(
-            user=self.user_2,
+            user=self.other_user,
             category=self.category,
             category=self.category,
             thread=thread,
             thread=thread,
             post=thread.first_post,
             post=thread.first_post,

+ 15 - 15
misago/threads/tests/test_post_mentions.py

@@ -75,18 +75,18 @@ class PostMentionsTests(AuthenticatedUserTestCase):
 
 
     def test_mention_update(self):
     def test_mention_update(self):
         """edit post endpoint updates mentions"""
         """edit post endpoint updates mentions"""
-        user_1 = create_test_user("User1", "user1@example.com")
-        user_2 = create_test_user("User2", "user2@example.com")
+        user = create_test_user("User", "user@example.com")
+        other_user = create_test_user("OtherUser", "otheruser@example.com")
 
 
         response = self.client.post(
         response = self.client.post(
-            self.post_link, data={"post": "This is test response, @%s!" % user_1}
+            self.post_link, data={"post": "This is test response, @%s!" % user}
         )
         )
         self.assertEqual(response.status_code, 200)
         self.assertEqual(response.status_code, 200)
 
 
         post = self.user.post_set.order_by("id").last()
         post = self.user.post_set.order_by("id").last()
 
 
         self.assertEqual(post.mentions.count(), 1)
         self.assertEqual(post.mentions.count(), 1)
-        self.assertEqual(post.mentions.order_by("id")[0], user_1)
+        self.assertEqual(post.mentions.order_by("id")[0], user)
 
 
         # add mention to post
         # add mention to post
         edit_link = reverse(
         edit_link = reverse(
@@ -96,43 +96,43 @@ class PostMentionsTests(AuthenticatedUserTestCase):
 
 
         response = self.put(
         response = self.put(
             edit_link,
             edit_link,
-            data={"post": "This is test response, @%s and @%s!" % (user_1, user_2)},
+            data={"post": "This is test response, @%s and @%s!" % (user, other_user)},
         )
         )
         self.assertEqual(response.status_code, 200)
         self.assertEqual(response.status_code, 200)
 
 
         self.assertEqual(post.mentions.count(), 2)
         self.assertEqual(post.mentions.count(), 2)
-        self.assertEqual(list(post.mentions.order_by("id")), [user_1, user_2])
+        self.assertEqual(list(post.mentions.order_by("id")), [user, other_user])
 
 
         # remove first mention from post - should preserve mentions
         # remove first mention from post - should preserve mentions
         response = self.put(
         response = self.put(
-            edit_link, data={"post": "This is test response, @%s!" % user_2}
+            edit_link, data={"post": "This is test response, @%s!" % other_user}
         )
         )
         self.assertEqual(response.status_code, 200)
         self.assertEqual(response.status_code, 200)
 
 
         self.assertEqual(post.mentions.count(), 2)
         self.assertEqual(post.mentions.count(), 2)
-        self.assertEqual(list(post.mentions.order_by("id")), [user_1, user_2])
+        self.assertEqual(list(post.mentions.order_by("id")), [user, other_user])
 
 
         # remove mentions from post - should preserve mentions
         # remove mentions from post - should preserve mentions
         response = self.put(edit_link, data={"post": "This is test response!"})
         response = self.put(edit_link, data={"post": "This is test response!"})
         self.assertEqual(response.status_code, 200)
         self.assertEqual(response.status_code, 200)
 
 
         self.assertEqual(post.mentions.count(), 2)
         self.assertEqual(post.mentions.count(), 2)
-        self.assertEqual(list(post.mentions.order_by("id")), [user_1, user_2])
+        self.assertEqual(list(post.mentions.order_by("id")), [user, other_user])
 
 
     def test_mentions_merge(self):
     def test_mentions_merge(self):
         """posts merge sums mentions"""
         """posts merge sums mentions"""
-        user_1 = create_test_user("User1", "user1@example.com")
-        user_2 = create_test_user("User2", "user2@example.com")
+        user = create_test_user("User1", "user1@example.com")
+        other_user = create_test_user("User2", "user2@example.com")
 
 
         response = self.client.post(
         response = self.client.post(
-            self.post_link, data={"post": "This is test response, @%s!" % user_1}
+            self.post_link, data={"post": "This is test response, @%s!" % user}
         )
         )
         self.assertEqual(response.status_code, 200)
         self.assertEqual(response.status_code, 200)
 
 
         post_a = self.user.post_set.order_by("id").last()
         post_a = self.user.post_set.order_by("id").last()
 
 
         self.assertEqual(post_a.mentions.count(), 1)
         self.assertEqual(post_a.mentions.count(), 1)
-        self.assertEqual(list(post_a.mentions.all()), [user_1])
+        self.assertEqual(list(post_a.mentions.all()), [user])
 
 
         # post second reply
         # post second reply
         self.user.last_post_on = None
         self.user.last_post_on = None
@@ -140,7 +140,7 @@ class PostMentionsTests(AuthenticatedUserTestCase):
 
 
         response = self.client.post(
         response = self.client.post(
             self.post_link,
             self.post_link,
-            data={"post": "This is test response, @%s and @%s!" % (user_1, user_2)},
+            data={"post": "This is test response, @%s and @%s!" % (user, other_user)},
         )
         )
         self.assertEqual(response.status_code, 200)
         self.assertEqual(response.status_code, 200)
 
 
@@ -150,4 +150,4 @@ class PostMentionsTests(AuthenticatedUserTestCase):
         post_b.merge(post_a)
         post_b.merge(post_a)
 
 
         self.assertEqual(post_a.mentions.count(), 2)
         self.assertEqual(post_a.mentions.count(), 2)
-        self.assertEqual(list(post_a.mentions.order_by("id")), [user_1, user_2])
+        self.assertEqual(list(post_a.mentions.order_by("id")), [user, other_user])

+ 5 - 5
misago/threads/tests/test_thread_model.py

@@ -395,15 +395,15 @@ class ThreadModelTests(TestCase):
         private thread gets deleted automatically
         private thread gets deleted automatically
         when there are no participants left in it
         when there are no participants left in it
         """
         """
-        user_1 = create_test_user("User1", "user1@example.com")
-        user_2 = create_test_user("User2", "user2@example.com")
+        user = create_test_user("User", "user@example.com")
+        other_user = create_test_user("OtherUser", "otheruser@example.com")
 
 
-        ThreadParticipant.objects.add_participants(self.thread, [user_1, user_2])
+        ThreadParticipant.objects.add_participants(self.thread, [user, other_user])
         self.assertEqual(self.thread.participants.count(), 2)
         self.assertEqual(self.thread.participants.count(), 2)
 
 
-        user_1.delete()
+        user.delete()
         Thread.objects.get(id=self.thread.id)
         Thread.objects.get(id=self.thread.id)
 
 
-        user_2.delete()
+        other_user.delete()
         with self.assertRaises(Thread.DoesNotExist):
         with self.assertRaises(Thread.DoesNotExist):
             Thread.objects.get(id=self.thread.id)
             Thread.objects.get(id=self.thread.id)