コード例 #1
0
    def setup (self):
        Subscriber.objects.all().delete()
        Subscription.objects.all().delete()
        ContentFeedRecord.objects.all().delete()

        import_all_feeds()

        subscriber = Subscriber.objects.create(email='*****@*****.**')
        updater = ContentFeedRecordUpdater()
        dispatcher = SubscriptionDispatcher()
        dispatcher.deliver_to = Mock()
        dispatcher.render = Mock()

        self.subscriber = Mock(wraps=subscriber)
        self.updater = Mock(wraps=updater)
        self.dispatcher = Mock(wraps=dispatcher)
コード例 #2
0
ファイル: tests.py プロジェクト: phxdata/mesa-councilmatic
    def updates_the_lastSent_time_of_the_subscription_to_the_feeds_lastUpdated_time(self):
        mock_feed = Mock()
        self.library.get_feed = lambda *a, **k: mock_feed
        mock_feed.get_updates_since = lambda *a, **k: [1, 2, 3]
        mock_feed.get_changes_to = lambda *a, **k: ({}, datetime.datetime.now())

        dispatcher = SubscriptionDispatcher()
        dispatcher.template_name = 'subscriptions/subscription_email.txt'
        dispatcher.deliver_to = Mock()
        dispatcher.record_delivery = Mock()

        dispatcher.dispatch_subscriptions_for(self.subscriber, self.library)

        assert_equal(self.subscription.last_sent,
                     datetime.datetime(2011, 8, 4, 6, 50))
コード例 #3
0
ファイル: tests.py プロジェクト: citizennerd/councilmatic
    def updates_the_lastSent_time_of_the_subscription_to_the_feeds_lastUpdated_time(self):
        mock_feed = Mock()
        self.library.get_feed = lambda *a, **k: mock_feed
        mock_feed.get_updates_since = lambda *a, **k: [1, 2, 3]
        mock_feed.get_changes_to = lambda *a, **k: {}

        dispatcher = SubscriptionDispatcher()
        dispatcher.template_name = 'subscriptions/subscription_email.txt'
        dispatcher.deliver_to = Mock()
        dispatcher.record_delivery = Mock()

        dispatcher.dispatch_subscriptions_for(self.subscriber, self.library)

        assert_equal(self.subscription.last_sent,
                     datetime.datetime(2011, 8, 4, 6, 50))
コード例 #4
0
ファイル: tests.py プロジェクト: mjumbewu/subscribe.me
    def test_updates_the_lastSent_time_of_the_subscription_to_the_feeds_lastUpdated_time (self):
        mock_feed = Mock()
        self.library.get_feed = lambda *a, **k: mock_feed

        # Iff we say that there is updated content, the last_sent datetime
        # should be updated.
        mock_feed.get_updated_since = lambda *a, **k: ['item']
        mock_feed.get_changes_to = lambda *a, **k: ({}, datetime(2011,8,4,5,40).replace(tzinfo=utc))

        dispatcher = SubscriptionDispatcher()
        dispatcher.template_name = 'subscriptions/subscription_email.txt'
        dispatcher.deliver_to = Mock()
        dispatcher.record_delivery = Mock()

        dispatcher.dispatch_subscriptions_for(self.subscriber, self.library)

        self.assertEqual(self.subscription.last_sent, datetime(2011,8,4,6,50).replace(tzinfo=utc))