Exemple #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])
Exemple #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])
Exemple #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)
Exemple #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)
Exemple #5
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')
Exemple #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')