Example #1
0
  def test_task_post_process_any(self):
    """ test that api.post creates a task and additional calls resume
    """
    nick = '*****@*****.**'
    uuid = 'HOWNOW'
    message = 'BROWNCOW'

    actor_ref = api.actor_get(api.ROOT, nick)

    # DROP
    old_max = api.MAX_FOLLOWERS_PER_INBOX
    api.MAX_FOLLOWERS_PER_INBOX = 1

    entry_ref = api.post(actor_ref, nick=nick, uuid=uuid, message=message)
    self.assertEqual(entry_ref.extra['title'], message)
    
    # make sure we can repeat
    two_entry_ref = api.post(actor_ref, nick=nick, uuid=uuid, message=message)
    self.assertEqual(entry_ref.uuid, two_entry_ref.uuid)
    
    # and that task_process_actor works
    task_more = api.task_process_any(api.ROOT)
    self.assert_(task_more)

    # and run out the queue
    task_more = api.task_process_any(api.ROOT)
    task_more = api.task_process_any(api.ROOT)
    task_more = api.task_process_any(api.ROOT)
    task_more = api.task_process_any(api.ROOT)

    def _nope():
      task_more = api.task_process_any(api.ROOT)
    
    self.assertRaises(exception.ApiNoTasks, _nope)

    api.MAX_FOLLOWERS_PER_INBOX = old_max  

    pass
Example #2
0
 def _nope():
   task_more = api.task_process_any(api.ROOT)
Example #3
0
def exhaust_queue_any():
  for i in xrange(1000):
    try:
      api.task_process_any(api.ROOT)
    except exception.ApiNoTasks:
      break