Skip to content

Commit

Permalink
adding tests for callback_shutting_down_changed
Browse files Browse the repository at this point in the history
  • Loading branch information
opalmer committed Feb 26, 2015
1 parent 9536c6c commit d1e0b87
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_agent/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ def fake_schedule_call(*args, **kwargs):
self.assertEqual(
schedule_call_args[0][0][1], agent.reannounce)

def test_callback_shutting_down_true(self):
config["agent_shutdown_timeout"] = 4242
agent = Agent()
self.assertIsNone(agent.shutdown_timeout)
agent.shutting_down = True
self.assertIsInstance(agent.shutdown_timeout, datetime)
expected = timedelta(
seconds=config["agent_shutdown_timeout"]) + datetime.utcnow()
self.assertDateAlmostEqual(agent.shutdown_timeout, expected)

def test_callback_shutting_down_false(self):
config["agent_shutdown_timeout"] = 4242
agent = Agent()
self.assertIsNone(agent.shutdown_timeout)
agent.shutting_down = True
agent.shutting_down = False
self.assertIsNone(agent.shutdown_timeout)

def test_shutting_down_getter(self):
config["shutting_down"] = 42
agent = Agent()
Expand Down

0 comments on commit d1e0b87

Please sign in to comment.