示例#1
0
  def test_ensure_when_missing(self):
    response = self.app.get(util.ensure_author_task('author'), headers={'X-AppEngine-QueueName': 'default'})

    self.assertEqual(response.status_int, 200)

    tasks = self.tasks.get_filtered_tasks()
    self.assertEqual([
        util.ingest_author_task('author'),
    ], [task.url for task in tasks])
示例#2
0
  def test_ensure_when_missing(self):
    response = self.app.get(util.ensure_author_task('author'), headers={'X-AppEngine-QueueName': 'default'})

    self.assertEqual(response.status_int, 200)

    tasks = self.tasks.get_filtered_tasks()
    self.assertEqual([
        util.ingest_author_task('author'),
    ], [task.url for task in tasks])
示例#3
0
  def test_ingest_author(self):
    metadata = '{HI}'
    self.respond_to_github('https://api.github.com/users/name', metadata)
    response = self.app.get(util.ingest_author_task('NAME'), headers={'X-AppEngine-QueueName': 'default'})
    self.assertEqual(response.status_int, 200)

    author = Author.get_by_id('name')
    self.assertIsNone(author.error)
    self.assertEqual(author.status, 'ready')
    self.assertEqual(author.metadata, metadata)
示例#4
0
  def test_ingest_author(self):
    metadata = '{HI}'
    self.respond_to_github('https://api.github.com/users/name', metadata)
    response = self.app.get(util.ingest_author_task('NAME'), headers={'X-AppEngine-QueueName': 'default'})
    self.assertEqual(response.status_int, 200)

    author = Author.get_by_id('name')
    self.assertIsNone(author.error)
    self.assertEqual(author.status, 'ready')
    self.assertEqual(author.metadata, metadata)
示例#5
0
文件: manage.py 项目: andymutton/v2
 def handle_get(self, name):
   author = Author.get_by_id(name.lower())
   if author is None:
     task_url = util.ingest_author_task(name)
     util.new_task(task_url, target='manage')
示例#6
0
 def handle_get(self, name):
     author = Author.get_by_id(name.lower())
     if author is None:
         task_url = util.ingest_author_task(name)
         util.new_task(task_url, target='manage')