Skip to content

Commit

Permalink
testの変数名からself.を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
Lai committed Sep 23, 2023
1 parent 31465e5 commit 5e504e6
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions accounts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ def setUp(self):
self.client.login(username="testuser1", password="testpass")

def test_success_post(self):
self.url = reverse("accounts:follow", kwargs={"username": "testuser2"})
response = self.client.post(self.url)
url = reverse("accounts:follow", kwargs={"username": "testuser2"})
response = self.client.post(url)

self.assertRedirects(
response,
Expand All @@ -324,15 +324,15 @@ def test_success_post(self):
self.assertTrue(FriendShip.objects.filter(follower=self.user1).exists())

def test_failure_post_with_not_exist_user(self):
self.url = reverse("accounts:follow", kwargs={"username": "testuser3"})
response = self.client.post(self.url)
url = reverse("accounts:follow", kwargs={"username": "testuser3"})
response = self.client.post(url)

self.assertEqual(response.status_code, 404)
self.assertFalse(FriendShip.objects.filter(follower=self.user1).exists())

def test_failure_post_with_self(self):
self.url = reverse("accounts:follow", kwargs={"username": "testuser1"})
response = self.client.post(self.url)
url = reverse("accounts:follow", kwargs={"username": "testuser1"})
response = self.client.post(url)

self.assertEqual(response.status_code, 400)
self.assertFalse(FriendShip.objects.filter(follower=self.user1).exists())
Expand All @@ -346,8 +346,8 @@ def setUp(self):
FriendShip.objects.create(follower=self.user1, followee=self.user2)

def test_success_post(self):
self.url = reverse("accounts:unfollow", kwargs={"username": "testuser2"})
response = self.client.post(self.url)
url = reverse("accounts:unfollow", kwargs={"username": "testuser2"})
response = self.client.post(url)

self.assertRedirects(
response,
Expand All @@ -358,15 +358,15 @@ def test_success_post(self):
self.assertFalse(FriendShip.objects.filter(follower=self.user1).exists())

def test_failure_post_with_not_exist_tweet(self):
self.url = reverse("accounts:unfollow", kwargs={"username": "testuser3"})
response = self.client.post(self.url)
url = reverse("accounts:unfollow", kwargs={"username": "testuser3"})
response = self.client.post(url)

self.assertEqual(response.status_code, 404)
self.assertTrue(FriendShip.objects.filter(follower=self.user1).exists())

def test_failure_post_with_incorrect_user(self):
self.url = reverse("accounts:unfollow", kwargs={"username": "testuser1"})
response = self.client.post(self.url)
url = reverse("accounts:unfollow", kwargs={"username": "testuser1"})
response = self.client.post(url)

self.assertEqual(response.status_code, 400)
self.assertTrue(FriendShip.objects.filter(follower=self.user1).exists())
Expand All @@ -378,8 +378,8 @@ def setUp(self):
self.client.login(username="testuser1", password="testpass")

def test_success_get(self):
self.url = reverse("accounts:following_list", kwargs={"username": "testuser1"})
response = self.client.get(self.url)
url = reverse("accounts:following_list", kwargs={"username": "testuser1"})
response = self.client.get(url)

self.assertEqual(response.status_code, 200)

Expand All @@ -390,7 +390,7 @@ def setUp(self):
self.client.login(username="testuser1", password="testpass")

def test_success_get(self):
self.url = reverse("accounts:follower_list", kwargs={"username": "testuser1"})
response = self.client.get(self.url)
url = reverse("accounts:follower_list", kwargs={"username": "testuser1"})
response = self.client.get(url)

self.assertEqual(response.status_code, 200)

0 comments on commit 5e504e6

Please sign in to comment.