def test_parse_cmd_name(self): cmd = 'Troester' result_test = { 'cmd': 'obr', 'name': 'troester', 'date': datetime.now().date(), 'param': [] } self.assertEqual(parse_cmd(cmd, self.commands), result_test)
def test_parse_cmd_tire(self): cmd = 'Troester_1 12-03-18' result_test = { 'cmd': None, 'name': None, 'date': datetime(2018, 3, 12, 0, 0).date(), 'param': ['troester_1'] } self.assertEqual(parse_cmd(cmd, self.commands), result_test)
def test_parse_cmd_date_param(self): cmd = '12-03-18 1Troester start' result_test = { 'cmd': 'start', 'name': None, 'date': datetime(2018, 3, 12, 0, 0).date(), 'param': ['1troester'] } self.assertEqual(parse_cmd(cmd, self.commands), result_test)
def test_parse_cmd_name_date(self): cmd = 'Troester 12-03-18' result_test = { 'cmd': 'obr', 'name': 'troester', 'date': datetime(2018, 3, 12, 0, 0).date(), 'param': [] } self.assertEqual(parse_cmd(cmd, self.commands), result_test)
def test_parse_cmd_bad_date(self): cmd = '40-02-18 1Troester start' # result_test = {'cmd': 'start', 'name': None, 'date': datetime(2018, 3, 12, 0, 0), 'param': ['1troester']} result_test = { 'name': None, 'date': datetime.now().date(), 'cmd': 'start', 'param': ['40-02-18', '1troester'] } self.assertEqual(parse_cmd(cmd, self.commands), result_test)