def test_no_date_required(self):
     args = ArgsModel()
     args.config = True
     success = argsParser._parse_and_validate(args)
     self.assertTrue(success)
     args = ArgsModel()
     args.serve = True
     success = argsParser._parse_and_validate(args)
     self.assertTrue(success)
 def test_date_required_fail(self):
     args = ArgsModel()
     args.query = True
     success = argsParser._parse_and_validate(args)
     self.assertFalse(success)
     args = ArgsModel()
     args.remove = True
     success = argsParser._parse_and_validate(args)
     self.assertFalse(success)
     args = ArgsModel()
     args.get = True
     success = argsParser._parse_and_validate(args)
     self.assertFalse(success)
 def test_double_action_fail(self):
     args = ArgsModel()
     args.config = True
     args.serve = True
     args.day = 'Mon'
     success = argsParser._parse_and_validate(args)
     self.assertFalse(success)
     args = ArgsModel()
     args.request = True
     args.remove = True
     args.day = 'Mon'
     success = argsParser._parse_and_validate(args)
     self.assertFalse(success)
     args = ArgsModel()
     args.get = True
     args.remove = True
     args.day = 'Mon'
     success = argsParser._parse_and_validate(args)
     self.assertFalse(success)
    def test_parse_and_validate_day(self):
        days = ['Mon', 'FRIDAY', 'wed', 'thurs', 'tues', 'tue', 'Saturday', 'sun']
        expected = [0, 4, 2, 3, 1, 1, 5, 6]

        for day in days:
            args = ArgsModel()
            args.request = True
            args.day = day
            success = argsParser._parse_and_validate(args)
            self.assertTrue(success)

            actual_day = args.day
            expected_day = expected[days.index(day)]
            self.assertEqual(actual_day, expected_day)
 def test_day_fail(self):
     args = ArgsModel()
     args.day = 'asdflkjasdf'
     success = argsParser._parse_and_validate(args)
     self.assertFalse(success)
 def test_double_date_fail(self):
     args = ArgsModel()
     args.day = 'Tues'
     args.date = '01/01'
     success = argsParser._parse_and_validate(args)
     self.assertFalse(success)
 def test_parse_and_validate_default_action(self):
     args = ArgsModel()
     args.day = 'Mon'
     success = argsParser._parse_and_validate(args)
     self.assertTrue(success)
 def test_parse_and_validate_date(self):
     args = ArgsModel()
     args.date = '01/01'
     success = argsParser._parse_and_validate(args)
     self.assertTrue(success)