foreman_expire_hosts 2.1.1 → 2.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/app/models/concerns/foreman_expire_hosts/host_ext.rb +1 -5
- data/lib/foreman_expire_hosts/version.rb +1 -1
- data/test/factories/foreman_expire_hosts_factories.rb +4 -0
- data/test/functional/concerns/hosts_controller_extensions_test.rb +1 -1
- data/test/unit/concerns/host_extensions_test.rb +31 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b51017605d1e78a328d639736c4fba5367f872ba
|
4
|
+
data.tar.gz: 00aaff59e5242156824203423ece81d2f213f415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a56ee4a45d47db3650f9e311a54c055fb200a84a7d6640f20532a8920660a42f39c47e702869174bf30a6462877a5583e6f5bdb5377e7f6637b51713afc20854
|
7
|
+
data.tar.gz: 50bea00b635d7fa753a43b81e1f6b8402d3f331fbaca61c7eb57c6add02e6f2287f143ccb7b50d61c1e74cd4d6055746f9c9eaa144fd1fe290618da7652a893a
|
@@ -62,14 +62,10 @@ module ForemanExpireHosts
|
|
62
62
|
expiration_grace_period_end_date <= Date.today
|
63
63
|
end
|
64
64
|
|
65
|
-
def pending_expiration_start_date
|
66
|
-
Date.today - Setting['notify1_days_before_host_expiry'].to_i
|
67
|
-
end
|
68
|
-
|
69
65
|
def pending_expiration?
|
70
66
|
return false unless expires?
|
71
67
|
return false if expired?
|
72
|
-
|
68
|
+
expired_on - Setting['notify1_days_before_host_expiry'].to_i <= Date.today
|
73
69
|
end
|
74
70
|
|
75
71
|
def can_modify_expiry_date?
|
@@ -157,6 +157,37 @@ class ForemanExpireHostsHostExtTest < ActiveSupport::TestCase
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
+
context 'a host expiring in a year' do
|
161
|
+
setup do
|
162
|
+
@host = FactoryGirl.build(:host, :expires_in_a_year)
|
163
|
+
end
|
164
|
+
|
165
|
+
test 'should expire' do
|
166
|
+
assert_equal (Date.today + 365), @host.expired_on
|
167
|
+
assert @host.expires?
|
168
|
+
end
|
169
|
+
|
170
|
+
test 'should not expire today' do
|
171
|
+
refute @host.expires_today?
|
172
|
+
end
|
173
|
+
|
174
|
+
test 'should not be expired' do
|
175
|
+
refute @host.expired?
|
176
|
+
end
|
177
|
+
|
178
|
+
test 'should not be expired past grace period' do
|
179
|
+
refute @host.expired_past_grace_period?
|
180
|
+
end
|
181
|
+
|
182
|
+
test 'should not be pending expiration' do
|
183
|
+
refute @host.pending_expiration?
|
184
|
+
end
|
185
|
+
|
186
|
+
test 'should only exist in correct scopes' do
|
187
|
+
exists_only_in_scopes(@host, ['expiring'])
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
160
191
|
context 'a host in grace period' do
|
161
192
|
setup do
|
162
193
|
@host = FactoryGirl.build(:host, :expired_grace)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_expire_hosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nagarjuna Rachaneni
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: deface
|