Example #1
0
 def test_valid(self):
     jq = JobQueue(self.db)
     jq.db['jobqueue'].drop()
     jq._create(capped=False)
     self.assertFalse(jq.valid())
     self.assertRaises(Exception, jq._create)
     jq.clear_queue()
Example #2
0
 def test_valid(self):
     jq = JobQueue(self.db)
     jq.db['jobqueue'].drop()
     jq._create(capped=False)
     self.assertFalse(jq.valid())
     self.assertRaises(Exception, jq._create)
     jq.clear_queue()
Example #3
0
 def test_publish(self):
     jq = JobQueue(self.db, collection_name=K.collection)
     job = {'message': 'hello world!'}
     jq.pub(job)
     self.assertEquals(jq.queue_count(), 1)
     jq.clear_queue()
     jq.q = None  # erase the queue
     self.assertRaises(Exception, jq.pub, job)
Example #4
0
 def test_next(self):
     jq = JobQueue(self.db)
     self.assertRaises(Exception, jq.next)
     job = {'message': 'hello world!'}
     jq.pub(job)
     row = jq.next()
     self.assertEquals(row['data']['message'], 'hello world!')
     jq.clear_queue()
Example #5
0
 def test_publish(self):
     jq = JobQueue(self.db)
     job = {'message': 'hello world!'}
     jq.pub(job)
     self.assertEquals(jq.queue_count(), 1)
     jq.clear_queue()
     jq.q = None  # erase the queue
     self.assertRaises(Exception, jq.pub, job)
Example #6
0
 def test_next(self):
     jq = JobQueue(self.db)
     self.assertRaises(Exception, jq.next)
     job = {'message': 'hello world!'}
     jq.pub(job)
     row = jq.next()
     self.assertEquals(row['data']['message'], 'hello world!')
     jq.clear_queue()
Example #7
0
 def test_init(self):
     jq = JobQueue(self.db)
     self.assertTrue(jq.valid())
     self.assertRaises(Exception, jq._create)
     jq.clear_queue()
Example #8
0
 def test_init(self):
     jq = JobQueue(self.db)
     self.assertTrue(jq.valid())
     self.assertRaises(Exception, jq._create)
     jq.clear_queue()