postfix_admin 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +25 -17
- data/lib/postfix_admin/base.rb +34 -5
- data/lib/postfix_admin/cli.rb +98 -17
- data/lib/postfix_admin/doveadm.rb +32 -0
- data/lib/postfix_admin/models.rb +42 -12
- data/lib/postfix_admin/runner.rb +48 -9
- data/lib/postfix_admin/version.rb +1 -1
- data/postfix_admin.gemspec +3 -2
- data/spec/base_spec.rb +36 -18
- data/spec/cli_spec.rb +51 -33
- data/spec/doveadm_spec.rb +35 -0
- data/spec/models_spec.rb +50 -1
- data/spec/runner_spec.rb +155 -14
- data/spec/spec_helper.rb +71 -45
- metadata +40 -22
data/lib/postfix_admin/runner.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'postfix_admin'
|
3
3
|
require 'postfix_admin/cli'
|
4
|
+
require 'postfix_admin/doveadm'
|
4
5
|
|
5
6
|
module PostfixAdmin
|
6
7
|
class Runner < Thor
|
@@ -14,9 +15,14 @@ module PostfixAdmin
|
|
14
15
|
runner{ @cli.show_summary(domain_name) }
|
15
16
|
end
|
16
17
|
|
17
|
-
desc "
|
18
|
-
def
|
19
|
-
runner{
|
18
|
+
desc "schemes", "List all supported password schemes"
|
19
|
+
def schemes
|
20
|
+
runner{ puts PostfixAdmin::Doveadm.schemes.join(' ') }
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "show [example.com | admin@example.com | user@example.com]", "Show domains or admins or mailboxes"
|
24
|
+
def show(name=nil)
|
25
|
+
runner{ @cli.show(name) }
|
20
26
|
end
|
21
27
|
|
22
28
|
desc "setup example.com password", "Setup a domain"
|
@@ -76,27 +82,55 @@ module PostfixAdmin
|
|
76
82
|
end
|
77
83
|
|
78
84
|
desc "add_account user@example.com password", "Add an account"
|
85
|
+
method_option :scheme, :type => :string, :aliases => "-s", :desc => "password scheme"
|
86
|
+
method_option :name, :type => :string, :aliases => "-n", :desc => "full name"
|
79
87
|
def add_account(address, password)
|
80
|
-
runner
|
88
|
+
runner do
|
89
|
+
if options[:scheme] == 'scheme'
|
90
|
+
warn "Specify password scheme"
|
91
|
+
help('add_account')
|
92
|
+
else
|
93
|
+
if options[:name] == 'name'
|
94
|
+
warn "Specify name"
|
95
|
+
help('add_account')
|
96
|
+
else
|
97
|
+
@cli.add_account(address, password, options[:scheme], options[:name])
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
81
101
|
end
|
82
102
|
|
83
103
|
desc "edit_account user@example.com", "Edit an account"
|
84
|
-
method_option :quota, :type => :numeric, :aliases => "-q", :desc => "
|
104
|
+
method_option :quota, :type => :numeric, :aliases => "-q", :desc => "quota limitation"
|
105
|
+
method_option :name, :type => :string, :aliases => "-n", :desc => "full name"
|
85
106
|
def edit_account(address)
|
86
107
|
runner do
|
87
108
|
if options.size == 0
|
88
109
|
warn "Use one or more options."
|
89
110
|
help('edit_account')
|
90
111
|
else
|
91
|
-
|
112
|
+
if options[:name] == 'name'
|
113
|
+
warn "Specify name"
|
114
|
+
help('edit_account')
|
115
|
+
else
|
116
|
+
@cli.edit_account(address, options)
|
117
|
+
end
|
92
118
|
end
|
93
119
|
end
|
94
120
|
end
|
95
121
|
|
96
122
|
desc "add_admin admin@example.com password", "Add an admin user"
|
97
|
-
method_option :super, :type => :boolean, :aliases => "-
|
123
|
+
method_option :super, :type => :boolean, :aliases => "-S", :desc => "register as a super admin"
|
124
|
+
method_option :scheme, :type => :string, :aliases => "-s", :desc => "password scheme"
|
98
125
|
def add_admin(user_name, password)
|
99
|
-
runner
|
126
|
+
runner do
|
127
|
+
if options[:scheme] == 'scheme'
|
128
|
+
warn "Specify password scheme"
|
129
|
+
help('add_admin')
|
130
|
+
else
|
131
|
+
@cli.add_admin(user_name, password, options[:super], options[:scheme])
|
132
|
+
end
|
133
|
+
end
|
100
134
|
end
|
101
135
|
|
102
136
|
desc "add_admin_domain admin@example.com example.com", "Add admin_domain"
|
@@ -120,6 +154,11 @@ module PostfixAdmin
|
|
120
154
|
runner{ @cli.delete_alias(address) }
|
121
155
|
end
|
122
156
|
|
157
|
+
desc "dump", "Dump all data"
|
158
|
+
def dump
|
159
|
+
runner{ @cli.dump }
|
160
|
+
end
|
161
|
+
|
123
162
|
desc "version", "Show postfix_admin version"
|
124
163
|
def version
|
125
164
|
require 'postfix_admin/version'
|
@@ -132,7 +171,7 @@ module PostfixAdmin
|
|
132
171
|
begin
|
133
172
|
yield
|
134
173
|
rescue Error, ArgumentError => e
|
135
|
-
|
174
|
+
abort e.message
|
136
175
|
end
|
137
176
|
end
|
138
177
|
end
|
data/postfix_admin.gemspec
CHANGED
@@ -3,9 +3,10 @@ require File.expand_path('../lib/postfix_admin/version', __FILE__)
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.add_dependency 'thor'
|
5
5
|
gem.add_dependency 'data_mapper'
|
6
|
-
gem.add_dependency 'do_mysql', '>= 0.10.
|
6
|
+
gem.add_dependency 'do_mysql', '>= 0.10.17'
|
7
7
|
gem.add_dependency 'dm-mysql-adapter'
|
8
|
-
gem.add_development_dependency '
|
8
|
+
gem.add_development_dependency 'rake', '~> 10.5.0'
|
9
|
+
gem.add_development_dependency 'rspec', '~> 3.4.0'
|
9
10
|
gem.add_development_dependency 'dm-sqlite-adapter'
|
10
11
|
|
11
12
|
gem.authors = ["Hitoshi Kurokawa"]
|
data/spec/base_spec.rb
CHANGED
@@ -12,7 +12,8 @@ describe PostfixAdmin::Base do
|
|
12
12
|
'database' => 'mysql://postfix:password@localhost/postfix',
|
13
13
|
'aliases' => 30,
|
14
14
|
'mailboxes' => 30,
|
15
|
-
'maxquota' => 100
|
15
|
+
'maxquota' => 100,
|
16
|
+
'scheme' => 'CRAM-MD5',
|
16
17
|
}
|
17
18
|
end
|
18
19
|
|
@@ -33,25 +34,26 @@ describe PostfixAdmin::Base do
|
|
33
34
|
@base.config[:mailboxes].should == 30
|
34
35
|
@base.config[:maxquota].should == 100
|
35
36
|
@base.config[:mailbox_quota].should == 100 * KB_TO_MB
|
37
|
+
@base.config[:scheme].should == 'CRAM-MD5'
|
36
38
|
end
|
37
39
|
|
38
40
|
it "#domain_exist?" do
|
39
|
-
Domain.exist?('example.com').should
|
41
|
+
Domain.exist?('example.com').should be true
|
40
42
|
end
|
41
43
|
|
42
44
|
it "#alias_exist?" do
|
43
|
-
Alias.exist?('user@example.com').should
|
44
|
-
Alias.exist?('unknown@example.com').should
|
45
|
+
Alias.exist?('user@example.com').should be true
|
46
|
+
Alias.exist?('unknown@example.com').should be false
|
45
47
|
end
|
46
48
|
|
47
49
|
it "#mailbox_exist?" do
|
48
|
-
Mailbox.exist?('user@example.com').should
|
49
|
-
Mailbox.exist?('unknown@example.com').should
|
50
|
+
Mailbox.exist?('user@example.com').should be true
|
51
|
+
Mailbox.exist?('unknown@example.com').should be false
|
50
52
|
end
|
51
53
|
|
52
54
|
it "#admin_exist?" do
|
53
|
-
Admin.exist?('admin@example.com').should
|
54
|
-
Admin.exist?('unknown_admin@example.com').should
|
55
|
+
Admin.exist?('admin@example.com').should be true
|
56
|
+
Admin.exist?('unknown_admin@example.com').should be false
|
55
57
|
end
|
56
58
|
|
57
59
|
describe "#add_domain" do
|
@@ -79,6 +81,14 @@ describe PostfixAdmin::Base do
|
|
79
81
|
(Alias.count - num_aliases).should be(1)
|
80
82
|
end
|
81
83
|
|
84
|
+
it "refuse empty password" do
|
85
|
+
lambda{ @base.add_account('new_user@example.com', '') }.should raise_error Error
|
86
|
+
end
|
87
|
+
|
88
|
+
it "refuse nil password" do
|
89
|
+
lambda{ @base.add_account('new_user@example.com', nil) }.should raise_error Error
|
90
|
+
end
|
91
|
+
|
82
92
|
it "can not add account which hsas invalid address" do
|
83
93
|
lambda{ @base.add_account('invalid.example.com', 'password') }.should raise_error Error
|
84
94
|
end
|
@@ -100,10 +110,18 @@ describe PostfixAdmin::Base do
|
|
100
110
|
it "can add an new admin" do
|
101
111
|
num_admins = Admin.count
|
102
112
|
@base.add_admin('admin@example.net', 'password')
|
103
|
-
Admin.exist?('admin@example.net').should
|
113
|
+
Admin.exist?('admin@example.net').should be true
|
104
114
|
(Admin.count - num_admins).should be(1)
|
105
115
|
end
|
106
116
|
|
117
|
+
it "refuse empty password" do
|
118
|
+
lambda{ @base.add_admin('admin@example.net', '') }.should raise_error Error
|
119
|
+
end
|
120
|
+
|
121
|
+
it "refuse nil password" do
|
122
|
+
lambda{ @base.add_admin('admin@example.net', nil) }.should raise_error Error
|
123
|
+
end
|
124
|
+
|
107
125
|
it "can not add exist admin" do
|
108
126
|
lambda{ @base.add_admin('admin@example.com', 'password') }.should raise_error Error
|
109
127
|
end
|
@@ -112,7 +130,7 @@ describe PostfixAdmin::Base do
|
|
112
130
|
describe "#add_admin_domain" do
|
113
131
|
it "#add_admin_domain" do
|
114
132
|
@base.add_admin_domain('admin@example.com', 'example.org')
|
115
|
-
Admin.find('admin@example.com').has_domain?('example.org').should
|
133
|
+
Admin.find('admin@example.com').has_domain?('example.org').should be true
|
116
134
|
end
|
117
135
|
|
118
136
|
it "can not add unknown domain for an admin" do
|
@@ -131,7 +149,7 @@ describe PostfixAdmin::Base do
|
|
131
149
|
describe "#delete_admin_domain" do
|
132
150
|
it "#delete_admin_domain" do
|
133
151
|
lambda{ @base.delete_admin_domain('admin@example.com', 'example.com') }.should_not raise_error
|
134
|
-
Admin.find('admin@example.com').has_domain?('example.com').should
|
152
|
+
Admin.find('admin@example.com').has_domain?('example.com').should be false
|
135
153
|
end
|
136
154
|
|
137
155
|
it "can not delete not administrated domain" do
|
@@ -152,7 +170,7 @@ describe PostfixAdmin::Base do
|
|
152
170
|
num_aliases = Alias.count
|
153
171
|
lambda { @base.add_alias('new_alias@example.com', 'goto@example.jp') }.should_not raise_error
|
154
172
|
(Alias.count - num_aliases).should be(1)
|
155
|
-
Alias.exist?('new_alias@example.com').should
|
173
|
+
Alias.exist?('new_alias@example.com').should be true
|
156
174
|
end
|
157
175
|
|
158
176
|
it "can not add an alias which has a same name as a mailbox" do
|
@@ -172,7 +190,7 @@ describe PostfixAdmin::Base do
|
|
172
190
|
describe "#delete_alias" do
|
173
191
|
it "can delete an alias" do
|
174
192
|
lambda{ @base.delete_alias('alias@example.com') }.should_not raise_error
|
175
|
-
Alias.exist?('alias@example.com').should
|
193
|
+
Alias.exist?('alias@example.com').should be false
|
176
194
|
end
|
177
195
|
|
178
196
|
it "can not delete mailbox" do
|
@@ -196,8 +214,8 @@ describe PostfixAdmin::Base do
|
|
196
214
|
it "can delete a domain" do
|
197
215
|
lambda{ @base.delete_domain('example.com') }.should_not raise_error
|
198
216
|
|
199
|
-
Domain.exist?('example.com').should
|
200
|
-
Admin.exist?('admin@example.com').should
|
217
|
+
Domain.exist?('example.com').should be false
|
218
|
+
Admin.exist?('admin@example.com').should be false
|
201
219
|
|
202
220
|
Alias.all(:domain_name => 'example.com').count.should be(0)
|
203
221
|
Mailbox.all(:domain_name => 'example.com').count.should be(0)
|
@@ -213,7 +231,7 @@ describe PostfixAdmin::Base do
|
|
213
231
|
describe "#delete_admin" do
|
214
232
|
it "can delete an admin" do
|
215
233
|
lambda{ @base.delete_admin('admin@example.com') }.should_not raise_error
|
216
|
-
Admin.exist?('admin@example.com').should
|
234
|
+
Admin.exist?('admin@example.com').should be false
|
217
235
|
end
|
218
236
|
|
219
237
|
it "can not delete unknown admin" do
|
@@ -224,8 +242,8 @@ describe PostfixAdmin::Base do
|
|
224
242
|
describe "#delete_account" do
|
225
243
|
it "can delete an account" do
|
226
244
|
lambda{ @base.delete_account('user@example.com') }.should_not raise_error
|
227
|
-
Mailbox.exist?('user@example.com').should
|
228
|
-
Alias.exist?('user@example.com').should
|
245
|
+
Mailbox.exist?('user@example.com').should be false
|
246
|
+
Alias.exist?('user@example.com').should be false
|
229
247
|
end
|
230
248
|
|
231
249
|
it "can not delete unknown account" do
|
data/spec/cli_spec.rb
CHANGED
@@ -54,14 +54,16 @@ describe PostfixAdmin::CLI do
|
|
54
54
|
capture(:stdout){ @cli.show_domain }.should_not =~ /ALL/
|
55
55
|
end
|
56
56
|
|
57
|
-
describe "#
|
57
|
+
describe "#show_account_details" do
|
58
58
|
it "shows information of an account" do
|
59
|
-
lambda { @cli.
|
60
|
-
capture(:stdout){ @cli.
|
59
|
+
lambda { @cli.show_account_details('user@example.com') }.should_not raise_error
|
60
|
+
result = capture(:stdout){ @cli.show_account_details('user@example.com') }
|
61
|
+
result.should =~ /Name/
|
62
|
+
result.should =~ /Quota/
|
61
63
|
end
|
62
64
|
|
63
65
|
it "raises error when unknown account" do
|
64
|
-
lambda { @cli.
|
66
|
+
lambda { @cli.show_account_details('unknown@example.com') }.should raise_error Error
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
@@ -104,12 +106,12 @@ describe PostfixAdmin::CLI do
|
|
104
106
|
describe "#super_admin" do
|
105
107
|
it "enables super admin flag of an admin" do
|
106
108
|
lambda{ @cli.super_admin('admin@example.com', false) }.should_not raise_error
|
107
|
-
Admin.find('admin@example.com').super_admin?.should
|
109
|
+
Admin.find('admin@example.com').super_admin?.should be true
|
108
110
|
end
|
109
111
|
|
110
112
|
it "disable super admin flag of an admin" do
|
111
113
|
lambda{ @cli.super_admin('all@example.com', true) }.should_not raise_error
|
112
|
-
Admin.find('all@example.com').super_admin?.should
|
114
|
+
Admin.find('all@example.com').super_admin?.should be false
|
113
115
|
end
|
114
116
|
|
115
117
|
it "can not user for unknown admin" do
|
@@ -119,7 +121,7 @@ describe PostfixAdmin::CLI do
|
|
119
121
|
|
120
122
|
it "#change_admin_password" do
|
121
123
|
lambda { @cli.change_admin_password('admin@example.com', 'new_password') }.should_not raise_error
|
122
|
-
Admin.find('admin@example.com').password.should ==
|
124
|
+
Admin.find('admin@example.com').password.should == CRAM_MD5_NEW_PASS
|
123
125
|
lambda { @cli.change_admin_password('unknown_admin@example.com', 'new_password') }.should raise_error Error
|
124
126
|
|
125
127
|
lambda { @cli.change_admin_password('admin@example.com', '1234') }.should raise_error ArgumentError
|
@@ -127,7 +129,7 @@ describe PostfixAdmin::CLI do
|
|
127
129
|
|
128
130
|
it "#change_account_password" do
|
129
131
|
lambda { @cli.change_account_password('user@example.com', 'new_password') }.should_not raise_error
|
130
|
-
Mailbox.find('user@example.com').password.should ==
|
132
|
+
Mailbox.find('user@example.com').password.should == CRAM_MD5_NEW_PASS
|
131
133
|
lambda { @cli.change_account_password('unknown@example.com', 'new_password') }.should raise_error Error
|
132
134
|
lambda { @cli.change_account_password('user@example.com', '1234') }.should raise_error ArgumentError
|
133
135
|
end
|
@@ -135,7 +137,7 @@ describe PostfixAdmin::CLI do
|
|
135
137
|
describe "#add_admin" do
|
136
138
|
it "can add a new admin" do
|
137
139
|
lambda { @cli.add_admin('new_admin@example.com', 'password') }.should_not raise_error
|
138
|
-
Admin.exist?('new_admin@example.com').should
|
140
|
+
Admin.exist?('new_admin@example.com').should be true
|
139
141
|
end
|
140
142
|
|
141
143
|
it "can not add exist admin" do
|
@@ -150,18 +152,18 @@ describe PostfixAdmin::CLI do
|
|
150
152
|
describe "#delete_admin" do
|
151
153
|
it "can delete an admin" do
|
152
154
|
lambda { @cli.delete_admin('admin@example.com') }.should_not raise_error
|
153
|
-
Admin.exist?('admin@example.com').should
|
155
|
+
Admin.exist?('admin@example.com').should be false
|
154
156
|
end
|
155
157
|
|
156
158
|
it "can delete a super admin" do
|
157
159
|
lambda { @cli.delete_admin('all@example.com') }.should_not raise_error
|
158
|
-
Admin.exist?('all@example.com').should
|
160
|
+
Admin.exist?('all@example.com').should be false
|
159
161
|
end
|
160
162
|
|
161
163
|
it "can delete an admin whish has multiple domains" do
|
162
164
|
@cli.add_admin_domain('admin@example.com', 'example.org')
|
163
165
|
lambda { @cli.delete_admin('admin@example.com') }.should_not raise_error
|
164
|
-
Admin.exist?('admin@example.com').should
|
166
|
+
Admin.exist?('admin@example.com').should be false
|
165
167
|
end
|
166
168
|
|
167
169
|
it "can not delete unknown admin" do
|
@@ -170,22 +172,22 @@ describe PostfixAdmin::CLI do
|
|
170
172
|
end
|
171
173
|
|
172
174
|
it "#add_alias and #delete_alias" do
|
173
|
-
lambda { @cli.add_alias('user@example.com', 'goto@example.jp') }.should raise_error
|
174
|
-
lambda { @cli.delete_alias('user@example.com') }.should raise_error
|
175
|
-
lambda { @cli.delete_alias('unknown@example.com') }.should raise_error
|
175
|
+
lambda { @cli.add_alias('user@example.com', 'goto@example.jp') }.should raise_error Error
|
176
|
+
lambda { @cli.delete_alias('user@example.com') }.should raise_error Error
|
177
|
+
lambda { @cli.delete_alias('unknown@example.com') }.should raise_error Error
|
176
178
|
|
177
179
|
lambda { @cli.add_alias('new_alias@example.com', 'goto@example.jp') }.should_not raise_error
|
178
|
-
Alias.exist?('new_alias@example.com').should
|
180
|
+
Alias.exist?('new_alias@example.com').should be true
|
179
181
|
|
180
182
|
lambda { @cli.delete_alias('new_alias@example.com') }.should_not raise_error
|
181
|
-
Alias.exist?('new_alias@example.com').should
|
183
|
+
Alias.exist?('new_alias@example.com').should be false
|
182
184
|
end
|
183
185
|
|
184
186
|
describe "#add_account" do
|
185
187
|
it "can add an account" do
|
186
188
|
lambda { @cli.add_account('new_user@example.com', 'password') }.should_not raise_error
|
187
|
-
Mailbox.exist?('new_user@example.com').should
|
188
|
-
Alias.exist?('new_user@example.com').should
|
189
|
+
Mailbox.exist?('new_user@example.com').should be true
|
190
|
+
Alias.exist?('new_user@example.com').should be true
|
189
191
|
end
|
190
192
|
|
191
193
|
it "can not add account of unknown domain" do
|
@@ -200,8 +202,8 @@ describe PostfixAdmin::CLI do
|
|
200
202
|
describe "#delete_accont" do
|
201
203
|
it "can delete an account" do
|
202
204
|
lambda { @cli.delete_account('user@example.com') }.should_not raise_error
|
203
|
-
Mailbox.exist?('user@example.com').should
|
204
|
-
Alias.exist?('user@example.com').should
|
205
|
+
Mailbox.exist?('user@example.com').should be false
|
206
|
+
Alias.exist?('user@example.com').should be false
|
205
207
|
end
|
206
208
|
|
207
209
|
it "can not delete unknown account" do
|
@@ -216,7 +218,7 @@ describe PostfixAdmin::CLI do
|
|
216
218
|
|
217
219
|
it "upcase will convert to downcase" do
|
218
220
|
lambda{ @cli.add_domain('ExAmPle.NeT') }.should_not raise_error
|
219
|
-
Domain.exist?('example.net').should
|
221
|
+
Domain.exist?('example.net').should be true
|
220
222
|
end
|
221
223
|
|
222
224
|
it "can not add exist domain" do
|
@@ -249,12 +251,12 @@ describe PostfixAdmin::CLI do
|
|
249
251
|
describe "#delete_domain" do
|
250
252
|
it "can delete exist domain" do
|
251
253
|
lambda { @cli.delete_domain('example.com') }.should_not raise_error
|
252
|
-
Domain.exist?('example.net').should
|
254
|
+
Domain.exist?('example.net').should be false
|
253
255
|
end
|
254
256
|
|
255
257
|
it "upcase will convert to downcase" do
|
256
258
|
lambda { @cli.delete_domain('eXaMplE.cOm') }.should_not raise_error
|
257
|
-
Domain.exist?('example.com').should
|
259
|
+
Domain.exist?('example.com').should be false
|
258
260
|
end
|
259
261
|
|
260
262
|
it "can delete related admins, addresses and aliases" do
|
@@ -268,19 +270,35 @@ describe PostfixAdmin::CLI do
|
|
268
270
|
@cli.add_admin('no_related@example.com', 'password')
|
269
271
|
|
270
272
|
lambda { @cli.delete_domain('example.com') }.should_not raise_error
|
271
|
-
Admin.exist?('admin@example.com').should
|
272
|
-
Admin.exist?('admin@example.org').should
|
273
|
-
Admin.exist?('other_admin@example.com').should
|
274
|
-
Admin.exist?('no_related@example.com').should
|
273
|
+
Admin.exist?('admin@example.com').should be false
|
274
|
+
Admin.exist?('admin@example.org').should be true
|
275
|
+
Admin.exist?('other_admin@example.com').should be false
|
276
|
+
Admin.exist?('no_related@example.com').should be true
|
275
277
|
|
276
278
|
# aliases should be removed
|
277
|
-
Alias.exist?('alias@example.com').should
|
278
|
-
Alias.exist?('user@example.com').should
|
279
|
-
Alias.exist?('user2@example.com').should
|
279
|
+
Alias.exist?('alias@example.com').should be false
|
280
|
+
Alias.exist?('user@example.com').should be false
|
281
|
+
Alias.exist?('user2@example.com').should be false
|
280
282
|
|
281
283
|
# mailboxes should be removed
|
282
|
-
Mailbox.exist?('user@example.com').should
|
283
|
-
Mailbox.exist?('user2@example.com').should
|
284
|
+
Mailbox.exist?('user@example.com').should be false
|
285
|
+
Mailbox.exist?('user2@example.com').should be false
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
describe "#dump" do
|
290
|
+
it do
|
291
|
+
lambda { @cli.dump }.should_not raise_error
|
292
|
+
end
|
293
|
+
|
294
|
+
it "print infomation of all domains" do
|
295
|
+
result = capture(:stdout){ @cli.dump }
|
296
|
+
result.should =~ /example.com,100,true/
|
297
|
+
result.should =~ /example.org,100,true/
|
298
|
+
result.should =~ /admin@example.com,"9186d855e11eba527a7a52ca82b313e180d62234f0acc9051b527243d41e2740",false,true/
|
299
|
+
result.should =~ /user@example.com,"","9186d855e11eba527a7a52ca82b313e180d62234f0acc9051b527243d41e2740",102400000,"example.com\/user@example.com\/",true/
|
300
|
+
result.should =~ /alias@example.com,"goto@example.jp",true/
|
301
|
+
result.should =~ /user@example.com,"goto@example.jp",true/
|
284
302
|
end
|
285
303
|
end
|
286
304
|
end
|