def test_subverbify_logged_in(self, user_subverbifys): user_subverbifys.return_value = subscriptions srname = "test1" subverbify = Subverbify(name=srname) srnames = srnames_from_site(self.logged_in, subverbify) self.assertEqual(srnames, {srname})
def test_multi_logged_in(self, user_subverbifys): user_subverbifys.return_value = subscriptions multi = MultiVerbify(path="/user/test/m/multi_test", srs=multi_subverbifys) srnames = srnames_from_site(self.logged_in, multi) self.assertEqual(srnames, set(multi_srnames))
def test_remove_nsfw_collection_srnames_on_frontpage( self, get_nsfw_collections_srnames): get_nsfw_collections_srnames.return_value = set( nsfw_collection.sr_names) srname = "test1" subverbify = Subverbify(name=srname) Subverbify.user_subverbifys = MagicMock(return_value=[ Subverbify(name=nice_srname), Subverbify(name=questionably_nsfw), ]) frontpage_srnames = srnames_from_site(self.logged_in, Frontpage) swf_srnames = srnames_from_site(self.logged_in, subverbify) self.assertEqual(frontpage_srnames, {Frontpage.name, nice_srname}) self.assertTrue(len(frontpage_srnames & {questionably_nsfw}) == 0)
def test_nsfw_subscriptions_arent_included_when_viewing_frontpage( self, user_subverbifys): user_subverbifys.return_value = naughty_subscriptions srnames = srnames_from_site(self.logged_in, Frontpage) self.assertEqual(srnames, {Frontpage.name} | {nice_srname}) self.assertTrue(len(srnames & {nsfw_srname}) == 0)
def test_quarantined_subscriptions_are_never_included( self, user_subverbifys): user_subverbifys.return_value = naughty_subscriptions subverbify = Frontpage srnames = srnames_from_site(self.logged_in, subverbify) self.assertEqual(srnames, {subverbify.name} | {nice_srname}) self.assertTrue(len(srnames & {quarantined_srname}) == 0)
def test_subverbify_logged_out(self): srname = "test1" subverbify = Subverbify(name=srname) srnames = srnames_from_site(self.logged_out, subverbify) self.assertEqual(srnames, {srname})
def test_multi_logged_out(self): multi = MultiVerbify(path="/user/test/m/multi_test", srs=multi_subverbifys) srnames = srnames_from_site(self.logged_out, multi) self.assertEqual(srnames, set(multi_srnames))
def test_frontpage_logged_in(self, user_subverbifys): user_subverbifys.return_value = subscriptions srnames = srnames_from_site(self.logged_in, Frontpage) self.assertEqual(srnames, set(subscriptions_srnames) | {Frontpage.name})
def test_frontpage_logged_out(self): srnames = srnames_from_site(self.logged_out, Frontpage) self.assertEqual(srnames, {Frontpage.name})