in pulseapi/creators/tests.py [0:0]
def test_hiding_inactive_profiles(self):
"""Testing that inactive profiles are not returned in the creator view"""
profile = UserProfile.objects.last()
profile.is_active = True
profile.save()
inactive_profile = UserProfile.objects.first()
inactive_profile.is_active = False
inactive_profile.save()
response = self.client.get('{creator_url}'.format(
creator_url=reverse('creators-list')
))
search_results = json.loads(str(response.content, 'utf-8'))['results']
list_of_profile_ids = [profile['profile_id'] for profile in search_results]
self.assertEqual(response.status_code, 200)
self.assertIn(profile.id, list_of_profile_ids)
self.assertNotIn(inactive_profile.id, list_of_profile_ids)