예제 #1
0
  def test_create_tasks_to_update_issue_tracker(self):
    Flake(name='foo1', count_day=1).put()
    key2 = Flake(name='foo2', count_day=3).put()
    key3 = Flake(name='foo3', count_day=5).put()
    Flake(name='foo4', count_day=2).put()
    key5 = Flake(name='foo5', count_day=200).put()

    path = '/cron/update_issue_tracker'
    response = self.test_app.get(path, headers={'X-AppEngine-Cron': 'true'})
    self.assertEqual(200, response.status_int)

    tasks = self.taskqueue_stub.get_filtered_tasks(queue_names='issue-updates')
    self.assertEqual(len(tasks), 3)
    self.assertEqual(tasks[0].url, '/issues/process/%s' % key2.urlsafe())
    self.assertEqual(tasks[1].url, '/issues/process/%s' % key3.urlsafe())
    self.assertEqual(tasks[2].url, '/issues/process/%s' % key5.urlsafe())
 def test_no_occurrences(self):
   flake_key = Flake(name='foo.bar').put()
   self.test_app.get('/all_flake_occurrences?key=%s' % flake_key.urlsafe())
예제 #3
0
 def test_redirects_to_all_flake_occurrences(self):
     key = Flake(name='foo').put()
     response = self.test_app.get('/search?q=foo', status=302)
     self.assertIn('location', response.headers)
     self.assertTrue(response.headers['location'].endswith(
         '/all_flake_occurrences?key=%s' % key.urlsafe()))