Example #1
0
    def test_get_job_or_promise(self):
        """Test get a promise of a job in the future"""

        job, promise, timeout = Job._get_job_or_promise(
            self.q.connection, self.q, self.timeout)
        self.assertLessEqual(timeout, self.timeout)
        self.assertIsNone(job)
        self.assertEqual(promise, self.q.name)
Example #2
0
    def test_get_job_or_promise(self):
        """Test get a promise of a job in the future"""

        job, promise, timeout = Job._get_job_or_promise(
            self.q.connection, self.q, self.timeout)
        self.assertLessEqual(timeout, self.timeout)
        self.assertIsNone(job)
        self.assertEqual(promise, self.q.name)
Example #3
0
    def test_get_job_no_promise(self):
        """Test get job and no promise"""

        job, promise, timeout = Job._get_job_or_promise(
            self.q.connection, self.q, self.timeout)
        self.assertEqual(timeout, self.timeout)
        self.assertEquals(job.id, self.job.id)
        self.assertIsNone(promise)
Example #4
0
    def test_get_job_no_promise(self):
        """Test get job and no promise"""

        job, promise, timeout = Job._get_job_or_promise(
            self.q.connection, self.q, self.timeout)
        self.assertEqual(timeout, self.timeout)
        self.assertEquals(job.id, self.job.id)
        self.assertIsNone(promise)
Example #5
0
    def test_get_no_job_no_promise(self):
        """Test get no job and no promise"""

        # job is in the future beyond the current
        # worker timeout
        job, promise, timeout = Job._get_job_or_promise(
            self.q.connection, self.q, 1)
        self.assertEqual(timeout, 1)
        self.assertIsNone(job)
        self.assertIsNone(promise)
Example #6
0
    def test_get_no_job_no_promise(self):
        """Test get no job and no promise"""

        # job is in the future beyond the current
        # worker timeout
        job, promise, timeout = Job._get_job_or_promise(
            self.q.connection, self.q, 1)
        self.assertEqual(timeout, 1)
        self.assertIsNone(job)
        self.assertIsNone(promise)
Example #7
0
 def test_get_earlier_job_no_promise(self):
     """Test get earlier job and no promise"""
     # Job enqueue after the first scheduled job
     # but to be exec ahead of the scheduled job
     now_job = self.q.enqueue(do_nothing)
     job, promise, timeout = Job._get_job_or_promise(
         self.q.connection, self.q, 60)
     # timeout should remain the same
     self.assertEqual(timeout, 60)
     self.assertEqual(now_job.id, job.id)
     self.assertIsNone(promise)
Example #8
0
 def test_get_earlier_job_no_promise(self):
     """Test get earlier job and no promise"""
     # Job enqueue after the first scheduled job
     # but to be exec ahead of the scheduled job
     now_job = self.q.enqueue(do_nothing)
     job, promise, timeout = Job._get_job_or_promise(
         self.q.connection, self.q, 60)
     # timeout should remain the same
     self.assertEqual(timeout, 60)
     self.assertEqual(now_job.id, job.id)
     self.assertIsNone(promise)