Ejemplo n.º 1
0
    def test_claim_code_shows_awards_after_claim(self):
        """Claim code URL should lead to award detail or list after claim"""
        user1 = self._get_user(username="******",
                               email="*****@*****.**")
        user2 = self._get_user(username="******",
                               email="*****@*****.**")
        b1 = Badge.objects.create(creator=user1, unique=False,
                                  title="Badge for claim viewing")
        da = DeferredAward(badge=b1, creator=user1, reusable=True)
        da.save()

        url = reverse('badger.views.claim_deferred_award',
                      args=(da.claim_code,))

        # First claim leads to a single award detail page.
        award = da.claim(user2)
        r = self.client.get(url, follow=False)
        eq_(302, r.status_code)
        award_url = reverse('badger.views.award_detail',
                            args=(award.badge.slug, award.pk))
        ok_(award_url in r['Location'])

        # Second claim leads to a list of awards.
        award = da.claim(user2)
        r = self.client.get(url, follow=False)
        eq_(302, r.status_code)
        list_url = reverse('badger.views.awards_list',
                            args=(award.badge.slug,))
        ok_(list_url in r['Location'])
Ejemplo n.º 2
0
    def test_claim_code_shows_awards_after_claim(self):
        """Claim code URL should lead to award detail or list after claim"""
        user1 = self._get_user(username="******", email="*****@*****.**")
        user2 = self._get_user(username="******", email="*****@*****.**")
        b1 = Badge.objects.create(creator=user1,
                                  unique=False,
                                  title="Badge for claim viewing")
        da = DeferredAward(badge=b1, creator=user1, reusable=True)
        da.save()

        url = reverse('badger.views.claim_deferred_award',
                      args=(da.claim_code, ))

        # First claim leads to a single award detail page.
        award = da.claim(user2)
        r = self.client.get(url, follow=False)
        eq_(302, r.status_code)
        award_url = reverse('badger.views.award_detail',
                            args=(award.badge.slug, award.pk))
        ok_(award_url in r['Location'])

        # Second claim leads to a list of awards.
        award = da.claim(user2)
        r = self.client.get(url, follow=False)
        eq_(302, r.status_code)
        list_url = reverse('badger.views.awards_list',
                           args=(award.badge.slug, ))
        ok_(list_url in r['Location'])
Ejemplo n.º 3
0
    def test_claim_code_shows_awards_after_claim(self):
        """Claim code URL should lead to award detail or list after claim"""
        user1 = self._get_user(username="******",
                               email="*****@*****.**")
        user2 = self._get_user(username="******",
                               email="*****@*****.**")
        b1 = Badge.objects.create(creator=user1, unique=False,
                                  title="Badge for claim viewing")
        da = DeferredAward(badge=b1, creator=user1)
        da.save()

        url = da.get_claim_url()

        # Before claim, code URL leads to claim page. 
        r = self.client.get(url, follow=False)
        eq_(200, r.status_code)
        doc = pq(r.content)
        form = doc('form#claim_award')

        # After claim, code URL leads to a single award detail page.
        award = da.claim(user2)
        r = self.client.get(url, follow=False)
        eq_(302, r.status_code)
        award_url = reverse('badger.views.award_detail',
                            args=(award.badge.slug, award.pk))
        ok_(award_url in r['Location'])
Ejemplo n.º 4
0
    def test_claim_code_shows_awards_after_claim(self):
        """Claim code URL should lead to award detail or list after claim"""
        user1 = self._get_user(username="******",
                               email="*****@*****.**")
        user2 = self._get_user(username="******",
                               email="*****@*****.**")
        b1 = Badge.objects.create(creator=user1, unique=False,
                                  title="Badge for claim viewing")
        da = DeferredAward(badge=b1, creator=user1)
        da.save()

        url = da.get_claim_url()

        # Before claim, code URL leads to claim page.
        r = self.client.get(url, follow=False)
        eq_(200, r.status_code)
        doc = pq(r.content)
        form = doc('form#claim_award')

        # After claim, code URL leads to a single award detail page.
        award = da.claim(user2)
        r = self.client.get(url, follow=False)
        eq_(302, r.status_code)
        award_url = reverse('badger.views.award_detail',
                            args=(award.badge.slug, award.pk))
        ok_(award_url in r['Location'])