bgneal@1212: """ bgneal@1212: Tests for the forums tasks. bgneal@1212: bgneal@1212: """ bgneal@1212: from django.test import TestCase bgneal@1212: from mock import call, patch bgneal@1212: bgneal@1212: from forums.tasks import new_post_task bgneal@1212: from forums.tasks import updated_post_task bgneal@1212: from forums.tasks import new_topic_task bgneal@1212: from forums.tasks import updated_topic_task bgneal@1212: bgneal@1212: bgneal@1212: class ForumsTasksTestCase(TestCase): bgneal@1212: @patch('forums.tasks.forums.latest') bgneal@1212: def test_new_post_task(self, latest_mock): bgneal@1212: bgneal@1212: new_post_task.s(42).apply() bgneal@1212: bgneal@1212: self.assertEquals(latest_mock.mock_calls, [ bgneal@1212: call.process_new_post(42), bgneal@1212: ]) bgneal@1212: bgneal@1212: @patch('forums.tasks.forums.latest') bgneal@1212: def test_updated_post_task(self, latest_mock): bgneal@1212: bgneal@1212: updated_post_task.s(42).apply() bgneal@1212: bgneal@1212: self.assertEquals(latest_mock.mock_calls, [ bgneal@1212: call.process_updated_post(42), bgneal@1212: ]) bgneal@1212: bgneal@1212: @patch('forums.tasks.forums.latest') bgneal@1212: def test_new_topic_task(self, latest_mock): bgneal@1212: bgneal@1212: new_topic_task.s(42).apply() bgneal@1212: bgneal@1212: self.assertEquals(latest_mock.mock_calls, [ bgneal@1212: call.process_new_topic(42), bgneal@1212: ]) bgneal@1212: bgneal@1212: @patch('forums.tasks.forums.latest') bgneal@1212: def test_updated_topic_task(self, latest_mock): bgneal@1212: bgneal@1212: updated_topic_task.s(42).apply() bgneal@1212: bgneal@1212: self.assertEquals(latest_mock.mock_calls, [ bgneal@1212: call.process_updated_topic(42), bgneal@1212: ])