Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2949be
commit 881dbe4
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#! /usr/bin/env rspec | ||
|
||
require_relative "test_helper" | ||
|
||
Yast.import "MailAliases" | ||
|
||
describe Yast::MailAliases do | ||
subject { described_class } | ||
|
||
around do |example| | ||
chroot_path = File.expand_path("../data/", __FILE__) | ||
change_scr_root(chroot_path) do | ||
subject.ReadAliases | ||
example.call | ||
end | ||
end | ||
|
||
describe ".ReadAliases" do | ||
it "reads aliases table and sets it without root alias" do | ||
expected_output =[{"comment"=>" Basic system aliases that MUST be present.\n", | ||
"alias"=>"postmaster", | ||
"destinations"=>"root"}, | ||
{"comment"=>"", "alias"=>"mailer-daemon", "destinations"=>"postmaster"}, | ||
{"comment"=>" amavis\n", "alias"=>"virusalert", "destinations"=>"root"}, | ||
{"comment"=>" General redirections for pseudo accounts in /etc/passwd.\n", | ||
"alias"=>"administrator", | ||
"destinations"=>"root"}] | ||
|
||
subject.ReadAliases | ||
expect(subject.aliases).to eq expected_output | ||
end | ||
|
||
it "reads root alias" do | ||
subject.ReadAliases | ||
expect(subject.root_alias).to eq "jreidinger" | ||
end | ||
end | ||
|
||
describe ".MergeRootAlias" do | ||
it "prepends new root_alias to copy of argument with its original comment" do | ||
input = [ | ||
{"comment"=>"", "alias"=>"mailer-daemon", "destinations"=>"postmaster"} | ||
] | ||
subject.root_alias = "my_little_pony" | ||
|
||
expected_output = [ | ||
{"comment"=>"", "alias"=>"root", "destinations" => "my_little_pony"}, | ||
{"comment"=>"", "alias"=>"mailer-daemon", "destinations"=>"postmaster"} | ||
] | ||
|
||
|
||
expect(subject.MergeRootAlias(input)).to eq expected_output | ||
end | ||
end | ||
|
||
describe ".GetRootAlias" do | ||
it "reads alieases and return root one" do | ||
expect(subject.GetRootAlias).to eq "jreidinger" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This is the aliases file - it says who gets mail for whom. | ||
# | ||
# >>>>>>>>>> The program "newaliases" will need to be run | ||
# >> NOTE >> after this file is updated for any changes | ||
# >>>>>>>>>> to show through to sendmail. | ||
# | ||
# It is probably best to not work as user root and redirect all | ||
# email to "root" to the address of a HUMAN who deals with this | ||
# system's problems. Then you don't have to check for important | ||
# email too often on the root account. | ||
# The "\root" will make sure that email is also delivered to the | ||
# root-account, but also forwared to the user "joe". | ||
#root: joe, \root | ||
|
||
root: jreidinger | ||
# Basic system aliases that MUST be present. | ||
postmaster: root | ||
mailer-daemon: postmaster | ||
# amavis | ||
virusalert: root | ||
# General redirections for pseudo accounts in /etc/passwd. | ||
administrator: root | ||
# mlmmj needs only one alias to function; this is with a mailinglist in | ||
# /var/spool/mlmmj/myownlist (remember full path): | ||
|