Example #1
0
    def has_isSubscribed_set_to_true_when_current_user_is_subscribed(self):
        from django.contrib.auth.models import User
        from subscriptions.models import Subscriber, Subscription
        from subscriptions.feeds import ContentFeedLibrary
        from main.feeds import NewLegislationFeed

        subscriber = Subscriber(username="******")
        subscriber.set_password("world")
        subscriber.save()

        library = ContentFeedLibrary()
        library.register(NewLegislationFeed, 'blah blah')

        feed = NewLegislationFeed()
        subscription = subscriber.subscribe(feed)
        subscriber.save()

        # Make the request.
        client = Client()
        assert client.login(username="******", password="******")
        response = client.get('/legislation/')

        # Check the context
        assert response.context['is_subscribed']
        assert_equal(response.context['subscription'], subscription)
Example #2
0
    def has_isSubscribed_set_to_true_when_current_user_is_subscribed(self):
        from django.contrib.auth.models import User
        from subscriptions.models import Subscriber, Subscription
        from subscriptions.feeds import ContentFeedLibrary
        from main.feeds import NewLegislationFeed

        subscriber = Subscriber(username="******")
        subscriber.set_password("world")
        subscriber.save()

        library = ContentFeedLibrary()
        library.register(NewLegislationFeed, 'blah blah')

        feed = NewLegislationFeed()
        subscription = subscriber.subscribe(feed)
        subscriber.save()

        # Make the request.
        client = Client()
        assert client.login(username="******", password="******")
        response = client.get('/legislation/')

        # Check the context
        assert response.context['is_subscribed']
        assert_equal(response.context['subscription'], subscription)