def test_validator_success(self): ticket = Ticket(username=USERNAME, user_id=USER_ID) ticket.category = 1 ticket.date = 508 ticket.price_id = 1 ticket.quantity = 2 ticket.status = 1 result = ticket.validate() assert result['status'] validator = ItemValidator(ticket.to_dict()) result = validator.check_ticket() assert result['status']
def test_validator_missing_quantity(self): ticket = Ticket(username=USERNAME, user_id=USER_ID) ticket.category = 1 ticket.date = 508 ticket.price_id = 1 ticket.status = 1 result = ticket.validate() assert result['status'] is False assert result['info'] == '數量未填喔' validator = ItemValidator(ticket.to_dict()) result = validator.check_ticket() assert result['status'] is False assert result['info'] == '數量未填喔'