def test_profile_not_returned__site_user_anonymous_user(self): request = RequestFactory().get( self.site_profile.fid.replace(settings.SOCIALHOME_URL, ""), HTTP_HOST="127.0.0.1:8000", ) profile = get_federable_object(request) self.assertIsNone(profile)
def test_profile_returned(self): request = RequestFactory().get( self.profile.fid.replace(settings.SOCIALHOME_URL, ""), HTTP_HOST="127.0.0.1:8000", ) profile = get_federable_object(request) self.assertTrue(isinstance(profile, base.Profile)) self.assertEqual(profile.id, self.profile.fid)
def test_content_returned(self): request = RequestFactory().get( self.content.fid.replace(settings.SOCIALHOME_URL, ""), HTTP_HOST="127.0.0.1:8000", ) content = get_federable_object(request) self.assertTrue(isinstance(content, base.Post)) self.assertEqual(content.id, self.content.fid) self.assertEqual(content.actor_id, self.profile.fid)
def test_profile_returned_for_root_profile(self): request = RequestFactory().get("/", HTTP_HOST="127.0.0.1:8000") with override_settings(SOCIALHOME_ROOT_PROFILE=self.user.username): profile = get_federable_object(request) self.assertTrue(isinstance(profile, base.Profile)) self.assertEqual(profile.id, self.profile.fid)