'Test that an anonymous user cannot access the API and an error is received.'

def test_anonymous(self):

    self.client.logout()
    resp = self.client.get(self.get_url(self.student.username))
    self.assertEqual(resp.status_code, status.HTTP_401_UNAUTHORIZED)
