~jonas-drange/ubuntu-webcatalog/tos-redirect

« back to all changes in this revision

Viewing changes to src/webcatalog/tests/test_views.py

  • Committer: Anthony Lenton
  • Date: 2013-03-01 16:28:52 UTC
  • mfrom: (177.1.2 amqp-oopses)
  • Revision ID: anthony.lenton@canonical.com-20130301162852-3qm23gcaqdtud66m
[r=lukasz-czyzykowski] Display the oops id on every error page, and generate oops reports in dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1408
1408
        ]
1409
1409
        self.assertEqual(sorted(expected), sorted(tasks))
1410
1410
 
1411
 
    @patch('webcatalog.management.commands.import_exhibits.urllib.urlopen')
1412
 
    def test_post_schedules_task(self, mock_urlopen):
1413
 
        fd = mock_urlopen.return_value
1414
 
        fd.code = 200
1415
 
        fd.read.return_value = "[]"
 
1411
    @patch('webcatalog.tasks.call_command')
 
1412
    def test_post_schedules_task(self, mock_call_command):
1416
1413
        self.make_user(permissions=['schedule_tasks'], logged_in=True)
1417
1414
        url = reverse('wc-tasks')
1418
1415
        data = {'task': 'import_exhibits'}
1419
1416
 
1420
 
        response = self.client.post(url, data=data, follow=True)
 
1417
        response = self.client.post(url, data=data, follow=False)
1421
1418
 
 
1419
        messages_cookie = response.client.cookies['messages'].output()
1422
1420
        msg_pat = r'Task id <span>[-\da-f]+</span> submitted'
1423
 
        match = re.search(msg_pat, response.content)
 
1421
        match = re.search(msg_pat, messages_cookie)
1424
1422
        self.assertFalse(match is None)
1425
 
        self.assertEqual(1, mock_urlopen.call_count)
 
1423
        self.assertEqual(1, mock_call_command.call_count)
1426
1424
 
1427
1425
 
1428
1426
class TaskStatusViewTestCase(TestCaseWithFactory):