def submit():
    data = request.form
    first_name = data['first_name']
    last_name = data['last_name']
    id = data['id']
    tel = data['tel']

    error_message = ""
    if validate_name(first_name) is not True:
        error_message = "กรุณากรอกชื่อให้ถูกต้อง"
        return render_template('error.html', message=error_message)
    if validate_name(last_name) is not True:
        error_message = "กรุณากรอกนามสกุลให้ถูกต้อง"
        return render_template('error.html', message=error_message)
    if validate_id(id) is not True:
        error_message = 'กรุณากรอกเลขบัตรประจำตัวให้ถูกต้อง'
        return render_template('error.html', message=error_message)
    if validate_phone_number(tel) is not True:
        error_message = 'กรุณากรอกหมายเลขโทรศัพท์ให้ถูกต้อง'
        return render_template('error.html', message=error_message)

    return render_template('success.html',
                           first_name=first_name,
                           last_name=last_name,
                           id=id,
                           tel=tel)
示例#2
0
def submit():
    data = request.form
    first_name = data['first_name']
    last_name = data['last_name']
    id = data['id']
    tel = data['tel']

    error_message = ""
    if validate_name(first_name) is not True:
        error_message = 'กรุณากรอกชื่อให้ถูกต้อง'
        return render_template('error.html', message=error_message)
    if validate_name(last_name) is not True:
        error_message = 'กรุณากรอกนามสกุลให้ถูกต้อง'
        return render_template('error.html', message=error_message)

    return render_template('success.html',
                           first_name=first_name,
                           last_name=last_name, id=id, tel=tel)
示例#3
0
 def test_validate_name_with_invalid_input_contain_special(self):
     self.assertEqual(False, validate_name("!#@///+-="))
示例#4
0
 def test_validate_name_with_valid_input(self):
     self.assertEqual(True, validate_name("hanif"))
示例#5
0
 def test_validate_id_len13(self):
     self.assertEqual(True, validate_name("1929900744144"))
示例#6
0
 def test_validate_name_with_invalid_input_special_char3(self):
     self.assertEqual(False, validate_name("'!*/-+อะไรกันครับเนี่ย $%#@"))
示例#7
0
 def test_validate_name_with_invalid_input_special_char(self):
     self.assertEqual(False, validate_name("ff_**"))
示例#8
0
 def test_validate_name_with_invalid_input_string_of_int(self):
     self.assertEqual(False, validate_name("12312121"))
示例#9
0
 def test_validate_name_with_empty_input(self):
     self.assertEqual(False, validate_name(""))
 def test_validate_name_false_with_valid_free(self):
     self.assertEqual(False, validate_name(""))
 def test_validate_name_false_with_valid_specialString(self):
     self.assertEqual(False, validate_name("thitipong#@]"))
示例#12
0
 def test_validate_name_with_valid_input_language(self):
     self.assertEqual(True, validate_name("Wittawat"))
示例#13
0
 def test_validate_name_with_space(self):
     self.assertEqual(False, validate_name("chu tima"))
示例#14
0
 def test_validate_name_with_invalid_input_contain_string_number_special(
         self):
     self.assertEqual(False, validate_name("Wittawat*#5000"))
示例#15
0
 def test_validate_name_with_invalid_input_contain_string_special(self):
     self.assertEqual(False, validate_name("*#Wittawat"))
示例#16
0
 def test_validate_name_with_invalid_input_spacial_char(self):
     self.assertEqual(False, validate_name("มีไรหรอ!"))
示例#17
0
 def test_validate_name_with_invalid_input_spacial_char_more_one(self):
     self.assertEqual(False, validate_name("$อะไร@เนี้ย#"))
 def test_validate_name_false_with_valid_specString(self):
     self.assertEqual(False, validate_name("thitipong purinsuwan"))
示例#19
0
 def test_validate_name_with_without_space(self):
     self.assertEqual(False, validate_name("ปอ ซ่า"))
 def test_validate_name_false_with_valid_hanif5(self):
     self.assertEqual(False, validate_name("hanif5"))
示例#21
0
 def test_validate_name_with_invalid_input_contain_string_of_int(self):
     self.assertEqual(False, validate_name("aaa122"))
 def test_validate_name_with_valid_input_name(self):
     self.assertEqual(True, validate_name("Anna"))
示例#23
0
 def test_validate_name_with_invalid_input_special_char2(self):
     self.assertEqual(False, validate_name("'!*/-+$%#@"))
 def test_validate_name_with_invalid_input_special_string(self):
     self.assertEqual(False, validate_name("มิว##!!!"))
示例#25
0
 def test_validate_name_with_invalid_input_empty_string(self):
     self.assertEqual(False, validate_name(" "))
 def test_validate_name_with_invalid_input_space(self):
     self.assertEqual(False, validate_name("มิ   ว"))
示例#27
0
 def test_validate_id_len12(self):
     self.assertEqual(False, validate_name("192990074414"))
 def test_validate_name_with_invalid_input_string_of_intstring(self):
     self.assertEqual(False, validate_name("1denny50"))
示例#29
0
 def test_validate_name_with_invalid_string_int_input(self):
     self.assertEqual(False, validate_name("1234"))
示例#30
0
 def test_validate_name_with_invalid_input_contained_string_of_int(self):
     self.assertEqual(False, validate_name("ชายปอzaa007"))