mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Fix tests
This commit is contained in:
parent
1054a3d2ba
commit
179845289b
4 changed files with 12 additions and 18 deletions
|
@ -10,9 +10,6 @@ class Nameserver < ActiveRecord::Base
|
||||||
validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true }
|
validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true }
|
||||||
# rubocop: enable Metrics/LineLength
|
# rubocop: enable Metrics/LineLength
|
||||||
|
|
||||||
# caching
|
|
||||||
after_commit :create_cache, on: [:create, :update]
|
|
||||||
|
|
||||||
# archiving
|
# archiving
|
||||||
has_paper_trail class_name: 'NameserverVersion'
|
has_paper_trail class_name: 'NameserverVersion'
|
||||||
after_destroy :domain_version
|
after_destroy :domain_version
|
||||||
|
@ -55,12 +52,6 @@ class Nameserver < ActiveRecord::Base
|
||||||
domain.create_version if domain
|
domain.create_version if domain
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_cache
|
|
||||||
CachedNameserver.create(snapshot)
|
|
||||||
rescue ActiveRecord::RecordNotUnique
|
|
||||||
logger.info('Nameserver already exists in cache; not caching')
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
hostname
|
hostname
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe Dnskey do
|
||||||
|
|
||||||
dk.generate_digest
|
dk.generate_digest
|
||||||
expect(dk.ds_digest).to eq('0B62D1BC64EFD1EE652FB102BDF1011BF514CCD9A1A0CFB7472AEA3B01F38C92')
|
expect(dk.ds_digest).to eq('0B62D1BC64EFD1EE652FB102BDF1011BF514CCD9A1A0CFB7472AEA3B01F38C92')
|
||||||
expect(dk.ds_key_tag).to eq(30607)
|
expect(dk.ds_key_tag).to eq('30607')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'generates correct DS digest and DS key tag for emta.ee' do
|
it 'generates correct DS digest and DS key tag for emta.ee' do
|
||||||
|
@ -37,6 +37,6 @@ describe Dnskey do
|
||||||
|
|
||||||
dk.save
|
dk.save
|
||||||
expect(dk.ds_digest).to eq('D7045D3C2EF7332409A132D935C8E2834A2AAB769B35BC370FA68C9445398288')
|
expect(dk.ds_digest).to eq('D7045D3C2EF7332409A132D935C8E2834A2AAB769B35BC370FA68C9445398288')
|
||||||
expect(dk.ds_key_tag).to eq(31051)
|
expect(dk.ds_key_tag).to eq('31051')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,7 +48,6 @@ describe Domain do
|
||||||
d = Domain.new
|
d = Domain.new
|
||||||
expect(d.valid?).to be false
|
expect(d.valid?).to be false
|
||||||
expect(d.errors.messages).to match_array({
|
expect(d.errors.messages).to match_array({
|
||||||
period: ['is not a number'],
|
|
||||||
owner_contact: ['Registrant is missing'],
|
owner_contact: ['Registrant is missing'],
|
||||||
admin_contacts: ['Admin contacts count must be between 1 - infinity'],
|
admin_contacts: ['Admin contacts count must be between 1 - infinity'],
|
||||||
nameservers: ['Nameservers count must be between 2-11'],
|
nameservers: ['Nameservers count must be between 2-11'],
|
||||||
|
|
|
@ -193,9 +193,11 @@ module Epp
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
registrant: { value: 'jd1234' },
|
registrant: { value: 'jd1234' },
|
||||||
contact: { value: 'sh8013', attrs: { type: 'admin' } },
|
_anonymus: [
|
||||||
contact: { value: 'sh8013', attrs: { type: 'tech' } },
|
{ contact: { value: 'sh8013', attrs: { type: 'admin' } } },
|
||||||
contact: { value: 'sh801333', attrs: { type: 'tech' } },
|
{ contact: { value: 'sh8013', attrs: { type: 'tech' } } },
|
||||||
|
{ contact: { value: 'sh801333', attrs: { type: 'tech' } } }
|
||||||
|
],
|
||||||
authInfo: {
|
authInfo: {
|
||||||
pw: {
|
pw: {
|
||||||
value: '2fooBAR'
|
value: '2fooBAR'
|
||||||
|
@ -235,9 +237,11 @@ module Epp
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
registrant: { value: 'jd1234' },
|
registrant: { value: 'jd1234' },
|
||||||
contact: { value: 'sh8013', attrs: { type: 'admin' } },
|
_anonymus: [
|
||||||
contact: { value: 'sh8013', attrs: { type: 'tech' } },
|
{ contact: { value: 'sh8013', attrs: { type: 'admin' } } },
|
||||||
contact: { value: 'sh801333', attrs: { type: 'tech' } },
|
{ contact: { value: 'sh8013', attrs: { type: 'tech' } } },
|
||||||
|
{ contact: { value: 'sh801333', attrs: { type: 'tech' } } }
|
||||||
|
],
|
||||||
authInfo: {
|
authInfo: {
|
||||||
pw: {
|
pw: {
|
||||||
value: '2fooBAR'
|
value: '2fooBAR'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue