def test_follow_api_endpoint(self): client = self.get_client() response = client.post(f'/api/profiles/{self.userb.username}/follow', {'action': 'follow'}) count = response.json().get('count') self.assertEqual(count, 1)
Response Content-Type is returned as text/html instead of application/json
Solution:
response = client.post(f'/api/profiles/{self.userb.username}/follow',
{'action': 'follow'}, format='json')
def test_follow_api_endpoint(self): client = self.get_client() response = client.post(f'/api/profiles/{self.userb.username}/follow', {'action': 'follow'}) count = response.json().get('count') self.assertEqual(count, 1)Response Content-Type is returned as text/html instead of application/json
Solution: