def test_is_subscribed(self): c = Collection.objects.get(pk=512) u = UserProfile() u.nickname = "unique" u.save() c.subscriptions.create(user=u) assert c.is_subscribed(u), "User isn't subscribed to collection."
def test_collection_favorite(self): c = {} u = UserProfile() u.nickname = 'unique' u.save() c['request'] = Mock() c['request'].amo_user = u collection = Collection.objects.get(pk=57274) # Not subscribed yet. doc = pq(collection_favorite(c, collection)) eq_(doc('button').text(), u'Add to Favorites') # Subscribed. collection.subscriptions.create(user=u) doc = pq(collection_favorite(c, collection)) eq_(doc('button').text(), u'Remove from Favorites')
def test_collection_favorite(self): c = {} u = UserProfile() u.nickname = "unique" u.save() c["request"] = Mock() c["request"].amo_user = u collection = Collection.objects.get(pk=57274) # Not subscribed yet. doc = pq(collection_favorite(c, collection)) eq_(doc("button").text(), u"Add to Favorites") # Subscribed. collection.subscriptions.create(user=u) doc = pq(collection_favorite(c, collection)) eq_(doc("button").text(), u"Remove from Favorites")