From: Fabian Grünbichler Date: Thu, 13 Aug 2020 10:54:51 +0000 (+0200) Subject: test: fix mail_test for non-root user X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=6a545c326c5e2661c8ac44e5afab59fb92388d4b;p=pve-manager.git test: fix mail_test for non-root user Signed-off-by: Fabian Grünbichler --- diff --git a/test/mail_test.pl b/test/mail_test.pl index 6c32f0fc..d0114441 100755 --- a/test/mail_test.pl +++ b/test/mail_test.pl @@ -35,13 +35,24 @@ sub prepare_long_mail { my ($result_text, $result_html); -my $mock_module = Test::MockModule->new('PVE::Tools'); -$mock_module->mock('sendmail', sub { +my $mock_tools_module = Test::MockModule->new('PVE::Tools'); +$mock_tools_module->mock('sendmail', sub { my (undef, undef, $text, $html, undef, undef) = @_; $result_text = $text; $result_html = $html; }); +my $mock_cluster_module = Test::MockModule->new('PVE::Cluster'); +$mock_cluster_module->mock('cfs_read_file', sub { + my $path = shift; + + if ($path eq 'datacenter.cfg') { + return {}; + } else { + die "unexpected cfs_read_file\n"; + } +}); + my $MAILTO = ['test_address@proxmox.com']; my $SELF = { opts => { mailto => $MAILTO },