Example #1
0
  def test_task_post(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

    try:
      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
      # and run out the queue
      for i in range(5):
        api.task_process_actor(api.ROOT, nick)
    
      self.assertRaises(exception.ApiNoTasks,
                        lambda: api.task_process_actor(api.ROOT, nick))
    finally:
      api.MAX_FOLLOWERS_PER_INBOX = old_max  
Example #2
0
    def test_task_post(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

        try:
            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
            # and run out the queue
            for i in range(5):
                api.task_process_actor(api.ROOT, nick)

            self.assertRaises(exception.ApiNoTasks,
                              lambda: api.task_process_actor(api.ROOT, nick))
        finally:
            api.MAX_FOLLOWERS_PER_INBOX = old_max
Example #3
0
def exhaust_queue(nick):
  for i in xrange(1000):
    try:
      api.task_process_actor(api.ROOT, nick)
    except exception.ApiNoTasks:
      break
Example #4
0
 def _nope():
   task_more = api.task_process_actor(api.ROOT, nick)
Example #5
0
def exhaust_queue(nick):
    for i in xrange(1000):
        try:
            api.task_process_actor(api.ROOT, nick)
        except exception.ApiNoTasks:
            break