From af5a8624a69fc3f528a0489984a272ff79a4ef0b Mon Sep 17 00:00:00 2001 From: Mark LaPerriere Date: Thu, 5 Feb 2015 23:05:10 -0500 Subject: [PATCH] add tests for birth and death worker methods --- tests/test_worker.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_worker.py b/tests/test_worker.py index c47a62e..e89f39b 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -379,3 +379,23 @@ class TestWorker(RQTestCase): w3 = Worker([q], name="worker1") worker_set = set([w1, w2, w3]) self.assertEquals(len(worker_set), 2) + + def test_worker_sets_birth(self): + """Ensure worker correctly sets worker birth date.""" + q = Queue() + w = Worker([q]) + + birth_date = w.birth_date + self.assertIsNotNone(birth_date) + self.assertEquals(type(birth_date).__name__, 'datetime') + + def test_worker_sets_death(self): + """Ensure worker correctly sets worker birth date.""" + q = Queue() + w = Worker([q]) + + w.register_death() + + death_date = w.death_date + self.assertIsNotNone(death_date) + self.assertEquals(type(death_date).__name__, 'datetime')