Ejemplo n.º 1
0
 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."
Ejemplo n.º 2
0
    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')
Ejemplo n.º 3
0
    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")