Commit 0eb3a5a8 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Write tests for aux-items 32 and 10100-10104.

parent 5d9e235f
......@@ -41,6 +41,17 @@ proc want_illegal_aux_item {tst} {
}
proc enable {} {
send "990 42 255\n"
simple_expect "=990"
}
proc disable {} {
send "991 42 0\n"
simple_expect "=991"
}
read_versions
lyskomd_start
......@@ -62,29 +73,29 @@ simple_expect "=1001 $server_compat_version 1 2 3 4 0 0 \\*"
# We cannot modify the system info unless we enable our privileges.
send "1002 95 0 { } 1 { 31 00000000 1 [holl "foo.bar.gazonk"] }\n"
simple_expect "%1002 12 0"
send "1003 42 255\n"
simple_expect "=1003"
enable
# Set the canonical-name.
send "1004 95 0 { } 1 { 31 00000000 1 [holl "foo.bar.gazonk"] }\n"
simple_expect "=1004"
send "1003 95 0 { } 1 { 31 00000000 1 [holl "foo.bar.gazonk"] }\n"
simple_expect "=1003"
send "1005 94\n"
simple_expect "=1005 $server_compat_version 1 2 3 4 0 1 { 1 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk"] }"
send "1004 94\n"
simple_expect "=1004 $server_compat_version 1 2 3 4 0 1 { 1 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk"] }"
# Check that we cannot have more than one canonical-name.
send "1006 95 0 { } 1 { 31 00000000 1 [holl "foo.bar.se"] }\n"
extracting_expect "%1006 (48|49) 0" errorcode 1
send "1005 95 0 { } 1 { 31 00000000 1 [holl "foo.bar.se"] }\n"
extracting_expect "%1005 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for duplicate canonical-name"
send "1007 94\n"
simple_expect "=1007 $server_compat_version 1 2 3 4 0 1 { 1 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk"] }"
send "1006 94\n"
simple_expect "=1006 $server_compat_version 1 2 3 4 0 1 { 1 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk"] }"
send "1008 95 1 { 1 } 1 { 31 00000000 1 [holl "foo.bar.gazonk:942"] }\n"
simple_expect "=1008"
send "1007 95 1 { 1 } 1 { 31 00000000 1 [holl "foo.bar.gazonk:942"] }\n"
simple_expect "=1007"
send "1009 94\n"
simple_expect "=1009 $server_compat_version 1 2 3 4 0 1 { 2 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk:942"] }"
send "1008 94\n"
simple_expect "=1008 $server_compat_version 1 2 3 4 0 1 { 2 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk:942"] }"
# Attempt to set a few malformed canonical names, and make sure that
# the name set above remains in effect.
......@@ -109,28 +120,207 @@ set_bad_canonical_name ":4711"
# Check that certain bits are cleared.
send "1010 95 1 { 2 } 1 { 31 01111111 8 [holl "kom.lysator.liu.se"] }\n"
simple_expect "=1010"
send "1009 95 1 { 2 } 1 { 31 01111111 8 [holl "kom.lysator.liu.se"] }\n"
simple_expect "=1009"
send "1011 94\n"
simple_expect "=1011 $server_compat_version 1 2 3 4 0 1 { 3 31 5 $any_time 01001111 8 [holl "kom.lysator.liu.se"] }"
send "1010 94\n"
simple_expect "=1010 $server_compat_version 1 2 3 4 0 1 { 3 31 5 $any_time 01001111 8 [holl "kom.lysator.liu.se"] }"
# Check that we cannot use canonical-name on texts or persons.
send "1012 86 [holl "foo"] 0 { } 1 { 31 00000000 1 [holl "kom.liu.se"] }\n"
extracting_expect "%1012 (48|49) 0" errorcode 1
disable
send "1011 86 [holl "foo"] 0 { } 1 { 31 00000000 1 [holl "kom.liu.se"] }\n"
extracting_expect "%1011 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for canonical-name on text"
send "1013 89 [holl "person foo"] [holl "password"] 00000000 1 { 31 00000000 1 [holl "kom.liu.se"] }\n"
extracting_expect "%1013 (48|49) 0" errorcode 1
send "1012 89 [holl "person foo"] [holl "password"] 00000000 1 { 31 00000000 1 [holl "kom.liu.se"] }\n"
extracting_expect "%1012 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for canonical-name on person"
send "1013 88 [holl "conference foo"] 00000000 1 { 31 00000000 1 [holl "kom.liu.se"] }\n"
extracting_expect "%1013 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for canonical-name on conference"
send "1014 44 0\n"
simple_expect "=1014"
#
# Test mx-list-name (32).
#
# Not on system.
enable
send "1014 95 0 { } 1 { 32 00000000 1 [holl "foo@bar.com"] }\n"
extracting_expect "%1014 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-list-name on system."
disable
# Not on text.
send "1015 86 [holl "foo"] 0 { } 1 { 32 00000000 1 [holl "foo@bar.com"] }\n"
extracting_expect "%1015 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-list-name on text"
# Not on person.
send "1016 89 [holl "person 6"] [holl "password"] 00000000 1 { 32 00000000 1 [holl "foo@bar.com"] }\n"
extracting_expect "%1016 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-list-name on person"
# On conference.
send "1017 88 [holl "conference 6"] 00000000 1 { 32 00000000 1 [holl "foo@bar.com"] }\n"
extracting_expect "=1017 (6|9)" aconf 1
# The above conference should be conference 6, but is conference 9,
# because the three failed attempts above to create persons or
# conferences consumes conference numbers. See FIXME-comments in
# do_create_conf() in conference.c, and create_person_generic in
# person.c.
set test "Attempting to create a conference preserves the next Conf_no"
setup_xfail "*-*-*"
if {$aconf == 6} {
pass "$test"
} else {
fail "$test"
}
unset test
# Test a few bad values
proc set_bad_list_name {item} {
global aconf
global any_time
send "992 93 $aconf 1 { 1 } 1 { 32 00000000 1 [holl "$item"] }\n"
simple_expect "%992 48 0"
send "993 91 $aconf\n"
simple_expect "=993 [holl "conference 6"] 00000000 $any_time $any_time 5 0 5 0 5 0 77 77 0 1 0 0 1 { 1 32 5 $any_time 00000000 1 [holl "foo@bar.com"] }"
}
set_bad_list_name "foo@bar@gazonk"
set_bad_list_name "foo@"
set_bad_list_name "@bar"
set_bad_list_name "@"
set_bad_list_name ""
#
# Test mx-mime-belongs-to (10100) and mx-mime-part-in (10101).
#
# Set up a "reverse" link: the subpart is entered first.
send "1018 86 [holl "part"] 1 { 0 $aconf } 1 { 10100 00000000 1 [holl "1"] }\n"
simple_expect "%1018 48 0"
send "1019 86 [holl "part"] 1 { 0 $aconf } 0 { }\n"
simple_expect "=1019 1"
send "1020 86 [holl "root"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "1"] }\n"
simple_expect "=1020 2"
send "1021 92 1 0 { } 1 { 10100 00000000 1 [holl "2"] }\n"
simple_expect "=1021"
# Set up a "forward" link: the root is entered first.
send "1022 86 [holl "root"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "4"] }\n"
simple_expect "%1022 48 0"
send "1023 86 [holl "root"] 1 { 0 $aconf } 0 { }\n"
simple_expect "=1023 3"
send "1024 86 [holl "part"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "3"] }\n"
simple_expect "=1024 4"
send "1025 92 3 0 { } 1 { 10100 00000000 1 [holl "4"] }\n"
simple_expect "=1025"
# Try a few broken text numbers.
send "1026 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "99"] }\n"
simple_expect "%1026 48 0"
send "1027 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "t"] }\n"
simple_expect "%1027 48 0"
send "1028 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl ""] }\n"
simple_expect "%1028 48 0"
send "1029 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "0"] }\n"
simple_expect "%1029 48 0"
send "1030 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "-4711"] }\n"
simple_expect "%1030 48 0"
send "1031 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "-1"] }\n"
simple_expect "%1031 48 0"
send "1032 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "+1"] }\n"
simple_expect "%1032 48 0"
send "1033 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl " 1"] }\n"
simple_expect "%1033 48 0"
send "1034 86 [holl "t"] 1 { 0 $aconf } 1 { 10101 00000000 1 [holl "1 "] }\n"
simple_expect "%1034 48 0"
# Not on conferences.
send "1035 88 [holl "badconf 1"] 00000000 1 { 10100 00000000 1 [holl "1"] }\n"
extracting_expect "%1035 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-belongs-to on conference"
send "1036 88 [holl "badconf 2"] 00000000 1 { 10101 00000000 1 [holl "1"] }\n"
extracting_expect "%1036 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-part-in on conference"
# Not on persons.
send "1037 89 [holl "badperson 1"] [holl "password"] 00000000 1 { 10100 00000000 1 [holl "1"] }\n"
extracting_expect "%1037 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-belongs-to on person"
send "1038 89 [holl "badperson 1"] [holl "password"] 00000000 1 { 10101 00000000 1 [holl "1"] }\n"
extracting_expect "%1038 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-part-in on person"
#
# Test mx-mime-misc (10102), mx-envelope-sender (10103) and
# mx-mime-file-name (10104).
#
send "1039 86 [holl "y"] 1 { 0 $aconf } 3 { 10102 00000000 1 [holl "header"] 10103 00000000 1 [holl "foo@bar"] 10104 00000000 1 [holl "readme.exe"] }\n"
simple_expect "=1039 5"
# Not on conferences.
send "1040 88 [holl "badconf 1"] 00000000 1 { 10102 00000000 1 [holl "header"] }\n"
extracting_expect "%1040 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-belongs-to on conference"
send "1041 88 [holl "badconf 1"] 00000000 1 { 10103 00000000 1 [holl "1"] }\n"
extracting_expect "%1041 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-belongs-to on conference"
send "1042 88 [holl "badconf 2"] 00000000 1 { 10104 00000000 1 [holl "1"] }\n"
extracting_expect "%1042 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-part-in on conference"
# Not on persons.
send "1043 89 [holl "badperson 1"] [holl "password"] 00000000 1 { 10102 00000000 1 [holl "header"] }\n"
extracting_expect "%1043 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-belongs-to on person"
send "1044 89 [holl "badperson 1"] [holl "password"] 00000000 1 { 10103 00000000 1 [holl "1"] }\n"
extracting_expect "%1044 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-belongs-to on person"
send "1045 89 [holl "badperson 1"] [holl "password"] 00000000 1 { 10104 00000000 1 [holl "1"] }\n"
extracting_expect "%1045 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for mx-mime-part-in on person"
#
# Shut down
#
enable
send "1046 44 0\n"
simple_expect "=1046"
client_death 0
lyskomd_death
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment