def test_profile_view(self):
        self.build_to_organizations()
        test_url = reverse('users:profile')
        # Test that anonymous users are redirected.
        response = self.client.get(test_url)
        self.assertEqual(response.status_code, 302)

        # Test that registered users see appropriate information.
        self.client.login(username='testuser0', password='pw')
        response = self.client.get(test_url)
        self.assertEqual(response.status_code, 200)
        self.assertTrue('testuser0' in response.content.decode())
        for user in User.objects.all():
            if user.username == 'testuser0':
                break
        for org in user.organization_set.all():
            self.assertTrue(org.name in response.content.decode())
Lets user view their profile details.
dataset/ETHPy150Open openlearningtools/opencompetencies/users/tests.py/UserViewTests.test_profile_view