コード例 #1
0
ファイル: test_tasks.py プロジェクト: mozilla/django-tidings
    def test_anonymous_only(self):
        """Make sure having mixed watches claims right ones."""
        # Watch some before registering.
        watch(email='*****@*****.**', save=True)
        watch(email='*****@*****.**', save=True)
        watch(email='*****@*****.**', save=True)

        # Register.
        u = user(email='*****@*****.**', save=True)

        claim_watches(u)

        # Original anonymous watch is claimed.
        assert not Watch.objects.filter(email='*****@*****.**').exists()
        self.assertEqual(2, Watch.objects.filter(email=None).count())
        self.assertEqual(2, Watch.objects.filter(user=u).count())

        # No other watches are affected.
        assert Watch.objects.filter(email='*****@*****.**').exists()
コード例 #2
0
    def test_mixed(self):
        """Make sure having mixed watches claims right ones."""
        # Watch before registering.
        watch(email='*****@*****.**', save=True)
        watch(email='*****@*****.**', save=True)

        # Register nobody.
        user(email='*****@*****.**', save=True)

        # Then register somebody and watch something after registering.
        u = user(email='*****@*****.**', save=True)
        watch(user=u, save=True)

        claim_watches(u)

        # Original anonymous watch is claimed.
        assert not Watch.objects.filter(email='*****@*****.**').exists()
        eq_(2, Watch.objects.filter(email=None).count())

        # No other watches are affected.
        assert Watch.objects.filter(email='*****@*****.**').exists()
コード例 #3
0
ファイル: test_tasks.py プロジェクト: mozilla/django-tidings
 def test_none(self):
     """No anonymous watches to claim."""
     u = user(email='*****@*****.**', save=True)
     claim_watches(u)