def test_deferred_award_immediate_claim(self):
        deferred_email = "awardee@example.com"
        user1 = self._get_user(username="creator", email="creator@example.com")
        b1 = Badge.objects.create(creator=user1, title="Badge to defer")

        da = DeferredAward(badge=b1, creator=user1)
        da.save()
        url = da.get_claim_url()

        # Just viewing the claim URL shouldn't require login.
        r = self.client.get(url, follow=False)
        eq_(200, r.status_code)

        # But, attempting to claim the award should require login
        r = self.client.post(reverse('badger.views.claim_deferred_award'), dict(
            code=da.claim_code,
        ), follow=False)
        eq_(302, r.status_code)
        ok_('login' in r['Location'])

        # So, try logging in and fetch the immediate-claim URL
        user2 = self._get_user(username="awardee", email=deferred_email)
        self.client.login(username="awardee", password="trustno1")
        r = self.client.post(reverse('badger.views.claim_deferred_award'), dict(
            code=da.claim_code,
        ), follow=False)
        eq_(302, r.status_code)
        ok_('awards' in r['Location'])

        ok_(b1.is_awarded_to(user2))
Constructor.
dataset/ETHPy150Open mozilla/django-badger/badger/tests/test_views.py/BadgerViewsTest.test_deferred_award_immediate_claim--crossover with--dataset/ETHPy150Open google/grr/grr/lib/aff4.py/Attribute.__init__