def test_friendship_add_friend(self):
        url = reverse('friendship_add_friend', kwargs={'to_username': self.user_amy.username})

        # test that the view requires authentication to access it
        response = self.client.get(url)
        self.assertResponse302(response)

        with self.login(self.user_bob.username, self.user_pw):
            # if we don't POST the view should return the
            # friendship_add_friend view
            response = self.client.get(url)
            self.assertResponse200(response)

            # on POST accept the friendship request and redirect to the
            # friendship_request_list view
            response = self.client.post(url)
            self.assertResponse302(response)
            redirect_url = reverse('friendship_request_list')
            self.assertTrue(redirect_url in response['Location'])
dataset/ETHPy150Open revsys/django-friendship/friendship/tests/tests.py/FriendshipViewTests.test_friendship_add_friend/original