mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 23:42:04 +02:00
Fix some epp tests
This commit is contained in:
parent
a740ed34f3
commit
f63eb66f02
6 changed files with 83 additions and 39 deletions
|
@ -3,12 +3,32 @@ class DelegationSigner < ActiveRecord::Base
|
|||
has_many :dnskeys
|
||||
|
||||
validate :validate_dnskeys_uniqueness
|
||||
validate :validate_dnskeys_count
|
||||
|
||||
|
||||
def epp_code_map
|
||||
{}
|
||||
sg = SettingGroup.domain_validation
|
||||
|
||||
{
|
||||
'2004' => [ # Parameter value range error
|
||||
[:dnskeys, :out_of_range,
|
||||
{
|
||||
min: sg.setting(Setting::DNSKEYS_MIN_COUNT).value,
|
||||
max: sg.setting(Setting::DNSKEYS_MAX_COUNT).value
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
def validate_dnskeys_uniqueness
|
||||
def validate_dnskeys_count
|
||||
sg = SettingGroup.domain_validation
|
||||
min, max = sg.setting(:dnskeys_min_count).value.to_i, sg.setting(:dnskeys_max_count).value.to_i
|
||||
return if dnskeys.reject(&:marked_for_destruction?).length.between?(min, max)
|
||||
errors.add(:dnskeys, :out_of_range, { min: min, max: max })
|
||||
end
|
||||
|
||||
def validate_dnskeys_uniqueness
|
||||
validated = []
|
||||
list = dnskeys.reject(&:marked_for_destruction?)
|
||||
list.each do |dnskey|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue