Exemplo n.º 1
0
    def test_collection_favorite(self):
        self.user = UserProfile.objects.create(username='******', email='uniq')

        c = {'request': Mock(amo_user=self.user)}
        collection = Collection.objects.create()

        # Not subscribed yet.
        doc = pq(collection_favorite(c, collection))
        eq_(doc('button').text(), u'Add to Favorites')

        # Subscribed.
        collection.following.create(user=self.user)
        doc = pq(collection_favorite(c, collection))
        eq_(doc('button').text(), u'Remove from Favorites')
Exemplo n.º 2
0
    def test_collection_favorite(self):
        self.user = UserProfile.objects.create(username='******', email='uniq')

        c = {'request': Mock(amo_user=self.user)}
        collection = Collection.objects.create()

        # Not subscribed yet.
        doc = pq(collection_favorite(c, collection))
        eq_(doc('button').text(), u'Add to Favorites')

        # Subscribed.
        collection.following.create(user=self.user)
        doc = pq(collection_favorite(c, collection))
        eq_(doc('button').text(), u'Remove from Favorites')
Exemplo n.º 3
0
    def test_collection_favorite(self):
        c = {}
        c['request'] = Mock()
        c['request'].amo_user = self.user
        collection = Collection.objects.get(pk=80)

        # Not subscribed yet.
        doc = pq(collection_favorite(c, collection))
        eq_(doc('button').text(), u'Add to Favorites')

        # Subscribed.
        collection.following.create(user=self.user)
        doc = pq(collection_favorite(c, collection))
        eq_(doc('button').text(), u'Remove from Favorites')
Exemplo n.º 4
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')
Exemplo n.º 5
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")