class AgentTest(unittest.TestCase): def setUp(self): self.configuration = mock.Mock() self.agent = Agent(self.configuration) def test_init(self): assert self.agent.configuration == self.configuration def test_execute(self): evaluate = self.configuration.evaluate push_status = self.configuration.push_status self.agent.execute() evaluate.assert_called_once() push_status.assert_not_called()
class AgentTest(unittest.TestCase): def setUp(self): self.configuration = mock.Mock() self.agent = Agent(self.configuration) def test_init(self): assert self.agent.configuration == self.configuration def test_execute(self): evaluate = self.configuration.evaluate push_status = self.configuration.push_status self.agent.execute() evaluate.assert_called_once() push_status.assert_not_called() def test_start(self): every = sys.modules['schedule'].every self.configuration.data = {'frequency': 5} self.agent.start() every.assert_called_with(5)
def setUp(self): self.configuration = mock.Mock() self.agent = Agent(self.configuration)