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)
Esempio n. 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)
Esempio n. 3
0
 def test_validate_name_with_invalid_input_contain_special(self):
     self.assertEqual(False, validate_name("!#@///+-="))
Esempio n. 4
0
 def test_validate_name_with_valid_input(self):
     self.assertEqual(True, validate_name("hanif"))
Esempio n. 5
0
 def test_validate_id_len13(self):
     self.assertEqual(True, validate_name("1929900744144"))
Esempio n. 6
0
 def test_validate_name_with_invalid_input_special_char3(self):
     self.assertEqual(False, validate_name("'!*/-+อะไรกันครับเนี่ย $%#@"))
Esempio n. 7
0
 def test_validate_name_with_invalid_input_special_char(self):
     self.assertEqual(False, validate_name("ff_**"))
Esempio n. 8
0
 def test_validate_name_with_invalid_input_string_of_int(self):
     self.assertEqual(False, validate_name("12312121"))
Esempio n. 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#@]"))
Esempio n. 12
0
 def test_validate_name_with_valid_input_language(self):
     self.assertEqual(True, validate_name("Wittawat"))
Esempio n. 13
0
 def test_validate_name_with_space(self):
     self.assertEqual(False, validate_name("chu tima"))
Esempio n. 14
0
 def test_validate_name_with_invalid_input_contain_string_number_special(
         self):
     self.assertEqual(False, validate_name("Wittawat*#5000"))
Esempio n. 15
0
 def test_validate_name_with_invalid_input_contain_string_special(self):
     self.assertEqual(False, validate_name("*#Wittawat"))
Esempio n. 16
0
 def test_validate_name_with_invalid_input_spacial_char(self):
     self.assertEqual(False, validate_name("มีไรหรอ!"))
Esempio n. 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"))
Esempio n. 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"))
Esempio n. 21
0
 def test_validate_name_with_invalid_input_contain_string_of_int(self):
     self.assertEqual(False, validate_name("aaa122"))
Esempio n. 22
0
 def test_validate_name_with_valid_input_name(self):
     self.assertEqual(True, validate_name("Anna"))
Esempio n. 23
0
 def test_validate_name_with_invalid_input_special_char2(self):
     self.assertEqual(False, validate_name("'!*/-+$%#@"))
Esempio n. 24
0
 def test_validate_name_with_invalid_input_special_string(self):
     self.assertEqual(False, validate_name("มิว##!!!"))
Esempio n. 25
0
 def test_validate_name_with_invalid_input_empty_string(self):
     self.assertEqual(False, validate_name(" "))
Esempio n. 26
0
 def test_validate_name_with_invalid_input_space(self):
     self.assertEqual(False, validate_name("มิ   ว"))
Esempio n. 27
0
 def test_validate_id_len12(self):
     self.assertEqual(False, validate_name("192990074414"))
Esempio n. 28
0
 def test_validate_name_with_invalid_input_string_of_intstring(self):
     self.assertEqual(False, validate_name("1denny50"))
Esempio n. 29
0
 def test_validate_name_with_invalid_string_int_input(self):
     self.assertEqual(False, validate_name("1234"))
Esempio n. 30
0
 def test_validate_name_with_invalid_input_contained_string_of_int(self):
     self.assertEqual(False, validate_name("ชายปอzaa007"))