def test_check_no_task(self, check_mock): with patch('builtins.input', return_value=None, side_effect='You must fill this field!'): work_log.check('task') check_mock.called_once()
def test_check_name_valid_true(self, input): self.assertEqual(work_log.check('name', True), "Feher Oszkar")
def test_check_task_valid(self, input): self.assertEqual(work_log.check('task'), "python")
def test_check_no_name(self, check_mock): with patch('builtins.input', return_value=None, side_effect='You must fill these fields!'): work_log.check('name') check_mock.called_once()
def test_check_name_invalid(self, check_mock): with patch('builtins.input', return_value=12, side_effect='JUST ALPHABET LETTERS!'): work_log.check('name') check_mock.called_once()
def test_check_name_valid(self, input): self.assertEqual(work_log.check('name'), "Oszkar Oszkar")
def test_check_time_invalid(self, check_mock): with patch('builtins.input', return_value='a', side_effect=ValueError): work_log.check('time') check_mock.called_once()
def test_check_time_valid(self, input): self.assertEqual(work_log.check('time'), 234)