From 8367e127c3f86da3fdaabc50e47a7a1b205b2325 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Fri, 28 Oct 2022 17:44:44 -0500 Subject: [PATCH] Add tests for email address handling --- testsuite/gatekeeper.all/11_email.exp | 260 ++++++++++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 testsuite/gatekeeper.all/11_email.exp diff --git a/testsuite/gatekeeper.all/11_email.exp b/testsuite/gatekeeper.all/11_email.exp new file mode 100644 index 0000000..e24e2b4 --- /dev/null +++ b/testsuite/gatekeeper.all/11_email.exp @@ -0,0 +1,260 @@ +# Tests for email address handling + +# Copyright (C) 2022 Jacob Bachmeyer +# +# This file is part of a testsuite for the GNU FTP upload system. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +proc check_email_handling {desc args} { + set tenv [new_test_environment] + + array set data { setup {} email-to {} } + array set data $args + + array set setup { packages {} blacklist {} } + array set setup $data(setup) + + register_test_packages $tenv $setup(packages) + + put_file [file join $tenv email.blacklist] \ + "[join $setup(blacklist) \"\n\"]\n" + + make_test_case $tenv { + foo.bin { + directive { + version 1.2 + filename foo.bin + directory foo + } dsig { good 00 1000 } + file { test } fsig { good 01 1000 } + } + } + + start_test_services $tenv + run_upload_batch_test + stop_test_services + + analyze_log $tenv "email: $desc" { + mail,addresses "outgoing mail sent" + workdone,1 "1 upload processed" + } + + analyze_mail $tenv "email: $desc" to $data(email-to) + + analyze_file_tree $tenv "email: $desc" \ + { incoming in-stage stage archive } empty {} + analyze_file_tree $tenv "email: $desc" \ + { pub } files { foo/foo.bin.sig foo/foo.bin } + + close_test_environment $tenv +} + +# ---------------------------------------- + +check_email_handling "basic" setup { + packages { + foo { + email { "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.org foo@example.net +} + +# ---------------------------------------- + +check_email_handling "key carries blacklisted address" setup { + packages { + foo { + email { "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } + blacklist { foo@example.gnu.org } +} email-to { + ftp-upload-script@gnu.org + ftp-upload-report@gnu.org foo@example.org foo@example.net +} + +check_email_handling "maintainers file contains blacklisted address" setup { + packages { + foo { + email { "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } + blacklist { foo@example.net } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.org +} + +check_email_handling "package email list contains blacklisted address" setup { + packages { + foo { + email { "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } + blacklist { foo@example.org } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.net +} + +# ---------------------------------------- + +check_email_handling "repeated address across key and maintainers list" setup { + packages { + foo { + email { "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.org +} + +check_email_handling "repeated address across maintainer and email lists" \ +setup { + packages { + foo { + email { "foo@example.net" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.net +} + +check_email_handling "repeated address across all three" setup { + packages { + foo { + email { "foo@example.gnu.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org +} + +check_email_handling "repeated address in maintainers list" setup { + packages { + foo { + email { "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " "bar " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.org foo@example.net +} + +check_email_handling "repeated address in package email list" setup { + packages { + foo { + email { "foo@example.org" "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.org foo@example.net +} + +check_email_handling "repeated addresses in both lists" setup { + packages { + foo { + email { "foo@example.org" "foo@example.net" } + keys { { id 1000 name "foo " } } + maintainers { "foo " "bar " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.org foo@example.net +} + +check_email_handling "repeated addresses five ways" setup { + packages { + foo { + email { "foo@example.org" "foo@example.gnu.org" "foo@example.net" } + keys { { id 1000 name "foo " } } + maintainers { "foo " "bar " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.org foo@example.net +} + +# ---------------------------------------- + +check_email_handling "key carries invalid address" setup { + packages { + foo { + email { "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } +} email-to { + ftp-upload-script@gnu.org + ftp-upload-report@gnu.org foo@example.org foo@example.net +} + +check_email_handling "maintainers list contains invalid address" setup { + packages { + foo { + email { "foo@example.org" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.org +} + +check_email_handling "package email list contains invalid address" setup { + packages { + foo { + email { "foovax!barvax!kremvax!vadim" } + keys { { id 1000 name "foo " } } + maintainers { "foo " } + } + } +} email-to { + ftp-upload-script@gnu.org foo@example.gnu.org + ftp-upload-report@gnu.org foo@example.net +} + +# ---------------------------------------- + +#EOF -- 2.25.1