def test___init__(self): """Testing method or function named __init__.""" # Initialize key variables parent = 'parent' child = 'child' # Test - No Child tester = agent.Agent(parent, config=self.config) self.assertEqual(tester.parent, parent) expected = files.pid_file(parent, self.config) self.assertEqual(tester.pidfile_parent, expected) expected = files.lock_file(parent, self.config) self.assertEqual(tester.lockfile_parent, expected) expected = files.pid_file(None, self.config) self.assertEqual(tester._pidfile_child, expected) # Test - With Child tester = agent.Agent(parent, child=child, config=self.config) self.assertEqual(tester.parent, parent) expected = files.pid_file(parent, self.config) self.assertEqual(tester.pidfile_parent, expected) expected = files.lock_file(parent, self.config) self.assertEqual(tester.lockfile_parent, expected) expected = files.pid_file(child, self.config) self.assertEqual(tester._pidfile_child, expected)
def test_name(self): """Testing method or function named name.""" # Initialize key variables parent = 'parent' # Test tester = agent.Agent(parent) self.assertEqual(tester.name(), parent)
def setUp(self): """Test setup""" # Setup base config and agent self._config = Config() self._agent = agent.Agent(parent=AGENT_NAME, config=self._config) # Instantiation of test daemon self._daemon = agent.BaseAgentDaemon(self._agent)
def setUp(self): """Test setup""" # Setup base config and agent self._config = Config() agent_name = general.random_agent_name() self._agent = agent.Agent(agent_name, config=self._config) # Instantiation of test daemon self._daemon = agent.AgentDaemon(self._agent)