Merge branch 'master' into alpha

This commit is contained in:
Priit Tark 2015-09-10 10:42:14 +03:00
commit 21e1a1a3d4
23 changed files with 2021 additions and 2023 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@ config/initializers/secret_token.rb
config/deploy.rb config/deploy.rb
config/secrets.yml config/secrets.yml
config/database.yml config/database.yml
misc
/export /export
/import /import
/ca /ca

View file

@ -24,3 +24,12 @@ services:
- postgresql - postgresql
addons: addons:
postgresql: "9.3" postgresql: "9.3"
notifications:
email:
- priit@gitlab.eu
- martin@gitlab.eu
branches:
only:
- master
- alpha
- staging

View file

@ -8,7 +8,7 @@ end if Bundler::VERSION < '2'
source 'https://rubygems.org' source 'https://rubygems.org'
# core # core
gem 'rails', '4.2.3' # when update, all initializers eis_custom files needs check/update gem 'rails', '4.2.4' # when update, all initializers eis_custom files needs check/update
gem 'iso8601', '0.8.6' # for dates and times gem 'iso8601', '0.8.6' # for dates and times
gem 'hashie-forbidden_attributes', '0.1.1' gem 'hashie-forbidden_attributes', '0.1.1'
gem 'SyslogLogger', '2.0', require: 'syslog/logger' gem 'SyslogLogger', '2.0', require: 'syslog/logger'

View file

@ -38,38 +38,38 @@ GEM
specs: specs:
SyslogLogger (2.0) SyslogLogger (2.0)
abstract_type (0.0.7) abstract_type (0.0.7)
actionmailer (4.2.3) actionmailer (4.2.4)
actionpack (= 4.2.3) actionpack (= 4.2.4)
actionview (= 4.2.3) actionview (= 4.2.4)
activejob (= 4.2.3) activejob (= 4.2.4)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.3) actionpack (4.2.4)
actionview (= 4.2.3) actionview (= 4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
rack (~> 1.6) rack (~> 1.6)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.3) actionview (4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.3) activejob (4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
globalid (>= 0.3.0) globalid (>= 0.3.0)
activemodel (4.2.3) activemodel (4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.2.3) activerecord (4.2.4)
activemodel (= 4.2.3) activemodel (= 4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
arel (~> 6.0) arel (~> 6.0)
activerecord-import (0.7.0) activerecord-import (0.7.0)
activerecord (>= 3.0) activerecord (>= 3.0)
activesupport (4.2.3) activesupport (4.2.4)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
@ -90,7 +90,7 @@ GEM
actionpack actionpack
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
rspec rspec
autoprefixer-rails (5.2.1.1) autoprefixer-rails (6.0.2)
execjs execjs
json json
axiom-types (0.1.1) axiom-types (0.1.1)
@ -181,7 +181,7 @@ GEM
builder (~> 3.2) builder (~> 3.2)
equalizer (0.0.11) equalizer (0.0.11)
erubis (2.7.0) erubis (2.7.0)
execjs (2.5.2) execjs (2.6.0)
fabrication (2.13.2) fabrication (2.13.2)
faker (1.4.3) faker (1.4.3)
i18n (~> 0.5) i18n (~> 0.5)
@ -230,7 +230,7 @@ GEM
rubocop (~> 0.20) rubocop (~> 0.20)
gyoku (1.3.1) gyoku (1.3.1)
builder (>= 2.1.2) builder (>= 2.1.2)
haml (4.0.6) haml (4.0.7)
tilt tilt
haml-rails (0.9.0) haml-rails (0.9.0)
actionpack (>= 4.0.1) actionpack (>= 4.0.1)
@ -273,7 +273,7 @@ GEM
kaminari (0.16.3) kaminari (0.16.3)
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
kgio (2.9.3) kgio (2.10.0)
launchy (2.4.3) launchy (2.4.3)
addressable (~> 2.3) addressable (~> 2.3)
libv8 (3.16.14.11) libv8 (3.16.14.11)
@ -282,7 +282,7 @@ GEM
listen (3.0.3) listen (3.0.3)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
loofah (2.0.2) loofah (2.0.3)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.9) lumberjack (1.0.9)
mail (2.6.3) mail (2.6.3)
@ -353,20 +353,20 @@ GEM
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
railroady (1.3.0) railroady (1.3.0)
rails (4.2.3) rails (4.2.4)
actionmailer (= 4.2.3) actionmailer (= 4.2.4)
actionpack (= 4.2.3) actionpack (= 4.2.4)
actionview (= 4.2.3) actionview (= 4.2.4)
activejob (= 4.2.3) activejob (= 4.2.4)
activemodel (= 4.2.3) activemodel (= 4.2.4)
activerecord (= 4.2.3) activerecord (= 4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.3) railties (= 4.2.4)
sprockets-rails sprockets-rails
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6) rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0) activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1) rails-deprecated_sanitizer (>= 1.0.1)
@ -374,9 +374,9 @@ GEM
loofah (~> 2.0) loofah (~> 2.0)
rails-settings-cached (0.4.1) rails-settings-cached (0.4.1)
rails (>= 4.0.0) rails (>= 4.0.0)
railties (4.2.3) railties (4.2.4)
actionpack (= 4.2.3) actionpack (= 4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.0.0) rainbow (2.0.0)
@ -388,7 +388,7 @@ GEM
activesupport (>= 3.0) activesupport (>= 3.0)
i18n i18n
polyamorous (~> 1.1) polyamorous (~> 1.1)
rb-fsevent (0.9.5) rb-fsevent (0.9.6)
rb-inotify (0.9.5) rb-inotify (0.9.5)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rdoc (4.2.0) rdoc (4.2.0)
@ -440,7 +440,7 @@ GEM
reek (= 1.6.5) reek (= 1.6.5)
virtus (~> 1.0) virtus (~> 1.0)
safe_yaml (1.0.4) safe_yaml (1.0.4)
sass (3.4.16) sass (3.4.18)
sass-rails (5.0.3) sass-rails (5.0.3)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (~> 3.1) sass (~> 3.1)
@ -479,9 +479,9 @@ GEM
spring (1.3.6) spring (1.3.6)
spring-commands-rspec (1.0.4) spring-commands-rspec (1.0.4)
spring (>= 0.9.1) spring (>= 0.9.1)
sprockets (3.2.0) sprockets (3.3.4)
rack (~> 1.0) rack (~> 1.0)
sprockets-rails (2.3.2) sprockets-rails (2.3.3)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
@ -600,7 +600,7 @@ DEPENDENCIES
que (= 0.10.0) que (= 0.10.0)
que-web (= 0.4.0) que-web (= 0.4.0)
railroady (= 1.3.0) railroady (= 1.3.0)
rails (= 4.2.3) rails (= 4.2.4)
rails-settings-cached (= 0.4.1) rails-settings-cached (= 0.4.1)
rake rake
ransack (= 1.5.1) ransack (= 1.5.1)

View file

@ -15,8 +15,8 @@ class EppController < ApplicationController
code: 2001, code: 2001,
msg: error msg: error
} }
response.headers['X-EPP-Returncode'] = '2200'
end end
handle_errors and return if epp_errors.any? handle_errors and return if epp_errors.any?
end end

View file

@ -23,4 +23,10 @@ class ApplicationMailer < ActionMailer::Base
"BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false" "BY MODEL OBJECT: id ##{model.try(:id)} deliver_emails returned false"
true true
end end
def format(email)
local, host = email.split('@')
host = SimpleIDN.to_ascii(host)
"#{local}@#{host}"
end
end end

View file

@ -6,7 +6,7 @@ class ContactMailer < ApplicationMailer
return if whitelist_blocked?(email) return if whitelist_blocked?(email)
begin begin
mail(to: email, subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]") mail(to: format(email), subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]")
rescue EOFError, rescue EOFError,
IOError, IOError,
TimeoutError, TimeoutError,

View file

@ -19,7 +19,7 @@ class DomainMailer < ApplicationMailer
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}" @verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
return if whitelist_blocked?(@old_registrant.email) return if whitelist_blocked?(@old_registrant.email)
mail(to: @old_registrant.email, mail(to: format(@old_registrant.email),
subject: "#{I18n.t(:pending_update_request_for_old_registrant_subject, subject: "#{I18n.t(:pending_update_request_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -42,7 +42,7 @@ class DomainMailer < ApplicationMailer
@old_registrant = Registrant.find(@domain.registrant_id_was) @old_registrant = Registrant.find(@domain.registrant_id_was)
return if whitelist_blocked?(@new_registrant.email) return if whitelist_blocked?(@new_registrant.email)
mail(to: @new_registrant.email, mail(to: format(@new_registrant.email),
subject: "#{I18n.t(:pending_update_notification_for_new_registrant_subject, subject: "#{I18n.t(:pending_update_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -52,7 +52,7 @@ class DomainMailer < ApplicationMailer
return if delivery_off?(@domain) return if delivery_off?(@domain)
return if whitelist_blocked?(@domain.registrant_email) return if whitelist_blocked?(@domain.registrant_email)
mail(to: @domain.registrant_email, mail(to: format(@domain.registrant_email),
subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject, subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -64,7 +64,7 @@ class DomainMailer < ApplicationMailer
@old_registrant_email = domain.registrant_email # Nb! before applying pending updates @old_registrant_email = domain.registrant_email # Nb! before applying pending updates
return if whitelist_blocked?(@old_registrant_email) return if whitelist_blocked?(@old_registrant_email)
mail(to: @old_registrant_email, mail(to: format(@old_registrant_email),
subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject, subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -77,7 +77,7 @@ class DomainMailer < ApplicationMailer
@new_registrant_name = @domain.pending_json['new_registrant_name'] @new_registrant_name = @domain.pending_json['new_registrant_name']
return if whitelist_blocked?(@new_registrant_email) return if whitelist_blocked?(@new_registrant_email)
mail(to: @new_registrant_email, mail(to: format(@new_registrant_email),
subject: "#{I18n.t(:pending_update_rejected_notification_for_new_registrant_subject, subject: "#{I18n.t(:pending_update_rejected_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -94,7 +94,7 @@ class DomainMailer < ApplicationMailer
logger.info "EMAIL NOT DELIVERED: no registrant email [pending_update_expired_notification_for_new_registrant]" logger.info "EMAIL NOT DELIVERED: no registrant email [pending_update_expired_notification_for_new_registrant]"
return return
end end
mail(to: @new_registrant_email, mail(to: format(@new_registrant_email),
subject: "#{I18n.t(:pending_update_expired_notification_for_new_registrant_subject, subject: "#{I18n.t(:pending_update_expired_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -119,7 +119,7 @@ class DomainMailer < ApplicationMailer
@verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}" @verification_url = "#{confirm_path}/#{@domain.id}?token=#{@domain.registrant_verification_token}"
return if whitelist_blocked?(@old_registrant.email) return if whitelist_blocked?(@old_registrant.email)
mail(to: @old_registrant.email, mail(to: format(@old_registrant.email),
subject: "#{I18n.t(:domain_pending_deleted_subject, subject: "#{I18n.t(:domain_pending_deleted_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -139,7 +139,7 @@ class DomainMailer < ApplicationMailer
end end
return if whitelist_blocked?(@domain.registrant.email) return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email, mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:pending_delete_rejected_notification_subject, subject: "#{I18n.t(:pending_delete_rejected_notification_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -149,7 +149,7 @@ class DomainMailer < ApplicationMailer
# no delivery off control, driggered by cron, no epp request # no delivery off control, driggered by cron, no epp request
return if whitelist_blocked?(@domain.registrant.email) return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email, mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:pending_delete_expired_notification_subject, subject: "#{I18n.t(:pending_delete_expired_notification_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end
@ -158,7 +158,7 @@ class DomainMailer < ApplicationMailer
@domain = domain @domain = domain
return if whitelist_blocked?(@domain.registrant.email) return if whitelist_blocked?(@domain.registrant.email)
mail(to: @domain.registrant.email, mail(to: format(@domain.registrant.email),
subject: "#{I18n.t(:delete_confirmation_subject, subject: "#{I18n.t(:delete_confirmation_subject,
name: @domain.name)} [#{@domain.name}]") name: @domain.name)} [#{@domain.name}]")
end end

View file

@ -4,6 +4,6 @@ class InvoiceMailer < ApplicationMailer
@invoice = invoice @invoice = invoice
attachments[invoice.pdf_name] = pdf attachments[invoice.pdf_name] = pdf
mail(to: invoice.billing_email, subject: invoice) mail(to: format(invoice.billing_email), subject: invoice)
end end
end end

View file

@ -10,12 +10,13 @@ class Domain < ActiveRecord::Base
belongs_to :registrar belongs_to :registrar
belongs_to :registrant belongs_to :registrant
has_many :domain_contacts, dependent: :destroy
has_many :admin_domain_contacts has_many :admin_domain_contacts
accepts_nested_attributes_for :admin_domain_contacts, allow_destroy: true accepts_nested_attributes_for :admin_domain_contacts, allow_destroy: true
has_many :tech_domain_contacts has_many :tech_domain_contacts
accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: true accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: true
# NB! contacts, admin_contacts, tech_contacts are empty for a new record
has_many :domain_contacts, dependent: :destroy
has_many :contacts, through: :domain_contacts, source: :contact has_many :contacts, through: :domain_contacts, source: :contact
has_many :admin_contacts, through: :admin_domain_contacts, source: :contact has_many :admin_contacts, through: :admin_domain_contacts, source: :contact
has_many :tech_contacts, through: :tech_domain_contacts, source: :contact has_many :tech_contacts, through: :tech_domain_contacts, source: :contact
@ -230,7 +231,7 @@ class Domain < ActiveRecord::Base
domains = Domain.where('valid_to <= ?', Time.zone.now) domains = Domain.where('valid_to <= ?', Time.zone.now)
domains.each do |domain| domains.each do |domain|
next unless domain.expirable? next unless domain.expirable?
domain.set_expired domain.set_graceful_expired
STDOUT << "#{Time.zone.now.utc} Domain.start_expire_period: ##{domain.id} #{domain.changes}\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} Domain.start_expire_period: ##{domain.id} #{domain.changes}\n" unless Rails.env.test?
domain.save(validate: false) domain.save(validate: false)
end end
@ -320,7 +321,12 @@ class Domain < ActiveRecord::Base
def expirable? def expirable?
return false if valid_to > Time.zone.now return false if valid_to > Time.zone.now
!statuses.include?(DomainStatus::EXPIRED)
if statuses.include?(DomainStatus::EXPIRED) && outzone_at.present? && delete_at.present?
return false
end
true
end end
def server_holdable? def server_holdable?
@ -545,8 +551,6 @@ class Domain < ActiveRecord::Base
self.registered_at = Time.zone.now self.registered_at = Time.zone.now
self.valid_from = Time.zone.now self.valid_from = Time.zone.now
self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit) self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
self.outzone_at = valid_to + Setting.expire_warning_period.days
self.delete_at = outzone_at + Setting.redemption_grace_period.days
end end
# rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/AbcSize
@ -603,6 +607,13 @@ class Domain < ActiveRecord::Base
save(validate: false) save(validate: false)
end end
def set_graceful_expired
self.outzone_at = valid_to + Setting.expire_warning_period.days
self.delete_at = outzone_at + Setting.redemption_grace_period.days
statuses << DomainStatus::EXPIRED
end
# TODO: This looks odd - outzone_at and delete_at will be the same value?
def set_expired def set_expired
# TODO: currently valid_to attribute update logic is open # TODO: currently valid_to attribute update logic is open
# self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit) # self.valid_to = valid_from + self.class.convert_period_to_time(period, period_unit)
@ -675,7 +686,6 @@ class Domain < ActiveRecord::Base
end end
def manage_automatic_statuses def manage_automatic_statuses
# domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if delete_candidateable?
if statuses.empty? && valid? if statuses.empty? && valid?
statuses << DomainStatus::OK statuses << DomainStatus::OK
elsif statuses.length > 1 || !valid? elsif statuses.length > 1 || !valid?

View file

@ -17,7 +17,7 @@ class DomainContact < ActiveRecord::Base
end end
def name def name
return 'Tech' if type == 'TechDomainContact' return 'Tech' if type == 'TechDomainContact'
return 'Admin' if type == 'AdminDomainContact' return 'Admin' if type == 'AdminDomainContact'
'' ''
end end

View file

@ -19,7 +19,16 @@ class Epp::Domain < Domain
before_save :link_contacts before_save :link_contacts
def link_contacts def link_contacts
# Based on bullet report # Based on bullet report
unlinked_contacts = contacts.select { |c| !c.linked? } # speed up a bit if new_record?
# new record does not have correct instance contacts entries thanks to epp
unlinked_contacts = [registrant]
unlinked_contacts << admin_domain_contacts.map(&:contact)
unlinked_contacts << tech_domain_contacts.map(&:contact)
unlinked_contacts.flatten!
else
unlinked_contacts = contacts.select { |c| !c.linked? } # speed up a bit
end
unlinked_contacts.each do |uc| unlinked_contacts.each do |uc|
uc.domains_present = true # no need to fetch domains again uc.domains_present = true # no need to fetch domains again
uc.save(validate: false) uc.save(validate: false)
@ -490,8 +499,8 @@ class Epp::Domain < Domain
p = self.class.convert_period_to_time(period, unit) p = self.class.convert_period_to_time(period, unit)
self.valid_to = valid_to + p self.valid_to = valid_to + p
self.outzone_at = valid_to + Setting.expire_warning_period.days self.outzone_at = nil
self.delete_at = outzone_at + Setting.redemption_grace_period.days self.delete_at = nil
self.period = period self.period = period
self.period_unit = unit self.period_unit = unit

View file

@ -33,13 +33,15 @@
%td %td
%p %p
- domain.statuses.each do |s| - if domain.statuses.present?
= s - domain.statuses.each do |s|
- notes = domain.status_notes[s] = s
- if notes - if domain.status_notes.present?
%br - notes = domain.status_notes[s]
%i= notes - if notes
%br %br
%i= notes
%br
- if domain.pending_json.present? - if domain.pending_json.present?
%p %p
= link_to t(:pending_epp), '#', class: 'js-pending-toggle' = link_to t(:pending_epp), '#', class: 'js-pending-toggle'

File diff suppressed because it is too large Load diff

View file

@ -23,25 +23,25 @@ Content-Type: application/json
``` ```
HTTP/1.1 200 HTTP/1.1 200
Cache-Control: max-age=0, private, must-revalidate Cache-Control: max-age=0, private, must-revalidate
Content-Length: 524 Content-Length: 564
Content-Type: application/json Content-Type: application/json
{ {
"contacts": [ "contacts": [
{ {
"id": 1, "id": 1,
"code": "sh523328490", "code": "REGISTRAR2:SH022086480",
"phone": "+372.12345678", "phone": "+372.12345678",
"email": "corene_koch@caspermoen.net", "email": "hoyt@deckowbechtelar.net",
"fax": null, "fax": null,
"created_at": "2015-04-16T08:48:39.551Z", "created_at": "2015-09-09T09:11:14.130Z",
"updated_at": "2015-04-16T08:48:39.551Z", "updated_at": "2015-09-09T09:11:14.130Z",
"ident": "37605030299", "ident": "37605030299",
"ident_type": "priv", "ident_type": "priv",
"auth_info": "password", "auth_info": "password",
"name": "Alana Williamson II0", "name": "Karson Kessler0",
"org_name": null, "org_name": null,
"registrar_id": 1, "registrar_id": 2,
"creator_str": null, "creator_str": null,
"updator_str": null, "updator_str": null,
"ident_country_code": "EE", "ident_country_code": "EE",
@ -50,7 +50,12 @@ Content-Type: application/json
"zip": "11111", "zip": "11111",
"country_code": "EE", "country_code": "EE",
"state": null, "state": null,
"legacy_id": null "legacy_id": null,
"statuses": [
"ok"
],
"status_notes": {
}
} }
], ],
"total_number_of_records": 2 "total_number_of_records": 2
@ -74,12 +79,12 @@ Content-Type: application/json
``` ```
HTTP/1.1 200 HTTP/1.1 200
Cache-Control: max-age=0, private, must-revalidate Cache-Control: max-age=0, private, must-revalidate
Content-Length: 56 Content-Length: 67
Content-Type: application/json Content-Type: application/json
{ {
"contacts": [ "contacts": [
"sh629765881" "REGISTRAR2:SH749456461"
], ],
"total_number_of_records": 2 "total_number_of_records": 2
} }

View file

@ -23,7 +23,7 @@ Content-Type: application/json
``` ```
HTTP/1.1 200 HTTP/1.1 200
Cache-Control: max-age=0, private, must-revalidate Cache-Control: max-age=0, private, must-revalidate
Content-Length: 578 Content-Length: 808
Content-Type: application/json Content-Type: application/json
{ {
@ -31,25 +31,40 @@ Content-Type: application/json
{ {
"id": 1, "id": 1,
"name": "domain0.ee", "name": "domain0.ee",
"registrar_id": 1, "registrar_id": 2,
"registered_at": "2015-04-16T08:48:39.995Z", "registered_at": "2015-09-09T09:11:14.861Z",
"status": null, "status": null,
"valid_from": "2015-04-16T00:00:00.000Z", "valid_from": "2015-09-09T09:11:14.861Z",
"valid_to": "2016-04-16T00:00:00.000Z", "valid_to": "2016-09-09T09:11:14.861Z",
"registrant_id": 1, "registrant_id": 1,
"auth_info": "3ec9a29d618023920b61758c339b638f", "auth_info": "98oiewslkfkd",
"created_at": "2015-04-16T08:48:39.992Z", "created_at": "2015-09-09T09:11:14.861Z",
"updated_at": "2015-04-16T08:48:39.991Z", "updated_at": "2015-09-09T09:11:14.860Z",
"name_dirty": "domain0.ee", "name_dirty": "domain0.ee",
"name_puny": "domain0.ee", "name_puny": "domain0.ee",
"period": 1, "period": 1,
"period_unit": "y", "period_unit": "y",
"creator_str": null, "creator_str": null,
"updator_str": null, "updator_str": null,
"whois_body": null,
"legacy_id": null, "legacy_id": null,
"legacy_registrar_id": null, "legacy_registrar_id": null,
"legacy_registrant_id": null "legacy_registrant_id": null,
"outzone_at": "2016-09-24T09:11:14.861Z",
"delete_at": "2016-10-24T09:11:14.861Z",
"registrant_verification_asked_at": null,
"registrant_verification_token": null,
"pending_json": {
},
"force_delete_at": null,
"statuses": [
"ok"
],
"reserved": false,
"status_notes": {
},
"statuses_backup": [
]
} }
], ],
"total_number_of_records": 2 "total_number_of_records": 2

View file

@ -38,7 +38,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverDeleteProhibited': [ 'serverDeleteProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -57,7 +57,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'clientHold': [ 'clientHold': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -75,7 +75,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverHold': [ 'serverHold': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -93,7 +93,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'clientRenewProhibited': [ 'clientRenewProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -117,7 +117,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverRenewProhibited': [ 'serverRenewProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -141,7 +141,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'clientTransferProhibited': [ 'clientTransferProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -165,7 +165,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverTransferProhibited': [ 'serverTransferProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -189,7 +189,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'clientUpdateProhibited': [ 'clientUpdateProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -213,7 +213,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverUpdateProhibited': [ 'serverUpdateProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -237,7 +237,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'pendingCreate': [ 'pendingCreate': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -257,7 +257,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'pendingDelete': [ 'pendingDelete': [
'clientHold', 'clientHold',
@ -276,7 +276,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'pendingRenew': [ 'pendingRenew': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -294,7 +294,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'pendingTransfer': [ 'pendingTransfer': [
@ -313,7 +313,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'pendingUpdate': [ 'pendingUpdate': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -331,7 +331,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverManualInzone': [ 'serverManualInzone': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -355,7 +355,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverRegistrantChangeProhibited': [ 'serverRegistrantChangeProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -380,7 +380,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverAdminChangeProhibited': [ 'serverAdminChangeProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -405,7 +405,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'serverTechChangeProhibited': [ 'serverTechChangeProhibited': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -430,7 +430,7 @@ task statuses: [:environment] do
'serverAdminChangeProhibited', 'serverAdminChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'forceDelete': [ 'forceDelete': [
'clientHold', 'clientHold',
@ -441,7 +441,7 @@ task statuses: [:environment] do
'serverAdminChangeProhibited', 'serverAdminChangeProhibited',
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'deleteCandidate': [ 'deleteCandidate': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -467,7 +467,7 @@ task statuses: [:environment] do
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate',
'expired', 'expired'
], ],
'expired': [ 'expired': [
'clientDeleteProhibited', 'clientDeleteProhibited',
@ -492,13 +492,13 @@ task statuses: [:environment] do
'serverAdminChangeProhibited', 'serverAdminChangeProhibited',
'serverTechChangeProhibited', 'serverTechChangeProhibited',
'forceDelete', 'forceDelete',
'deleteCandidate', 'deleteCandidate'
] ]
} }
puts "\nDomain status can be with other statuses map\n" puts "\nDomain status can be with other statuses map\n"
puts "---------------------------------------------" puts "---------------------------------------------"
statuses.each do |s,v| statuses.each do |s, _v|
puts "\n#{s} =>" puts "\n#{s} =>"
statuses[s].map { |u| puts " #{u}" } statuses[s].map { |u| puts " #{u}" }
puts puts
@ -520,7 +520,7 @@ task statuses: [:environment] do
'serverUpdateProhibited', 'serverUpdateProhibited',
'pendingCreate', 'pendingCreate',
'pendingTransfer', 'pendingTransfer',
'pendingUpdate', 'pendingUpdate'
], ],
'serverDeleteProhibited': [ 'serverDeleteProhibited': [
'linked', 'linked',
@ -531,7 +531,7 @@ task statuses: [:environment] do
'serverUpdateProhibited', 'serverUpdateProhibited',
'pendingCreate', 'pendingCreate',
'pendingTransfer', 'pendingTransfer',
'pendingUpdate', 'pendingUpdate'
], ],
'clientTransferProhibited': [ 'clientTransferProhibited': [
'linked', 'linked',
@ -542,7 +542,7 @@ task statuses: [:environment] do
'serverUpdateProhibited', 'serverUpdateProhibited',
'pendingCreate', 'pendingCreate',
'pendingDelete', 'pendingDelete',
'pendingUpdate', 'pendingUpdate'
], ],
'serverTransferProhibited': [ 'serverTransferProhibited': [
'linked', 'linked',
@ -553,7 +553,7 @@ task statuses: [:environment] do
'serverUpdateProhibited', 'serverUpdateProhibited',
'pendingCreate', 'pendingCreate',
'pendingDelete', 'pendingDelete',
'pendingUpdate', 'pendingUpdate'
], ],
'clientUpdateProhibited': [ 'clientUpdateProhibited': [
'linked', 'linked',
@ -564,7 +564,7 @@ task statuses: [:environment] do
'serverUpdateProhibited', 'serverUpdateProhibited',
'pendingCreate', 'pendingCreate',
'pendingDelete', 'pendingDelete',
'pendingTransfer', 'pendingTransfer'
], ],
'serverUpdateProhibited': [ 'serverUpdateProhibited': [
'linked', 'linked',
@ -575,7 +575,7 @@ task statuses: [:environment] do
'clientUpdateProhibited', 'clientUpdateProhibited',
'pendingCreate', 'pendingCreate',
'pendingDelete', 'pendingDelete',
'pendingTransfer', 'pendingTransfer'
], ],
'pendingCreate': [ 'pendingCreate': [
'linked', 'linked',
@ -584,7 +584,7 @@ task statuses: [:environment] do
'clientTransferProhibited', 'clientTransferProhibited',
'serverTransferProhibited', 'serverTransferProhibited',
'clientUpdateProhibited', 'clientUpdateProhibited',
'serverUpdateProhibited', 'serverUpdateProhibited'
], ],
'pendingDelete': [ 'pendingDelete': [
'linked', 'linked',
@ -593,7 +593,7 @@ task statuses: [:environment] do
'clientTransferProhibited', 'clientTransferProhibited',
'serverTransferProhibited', 'serverTransferProhibited',
'clientUpdateProhibited', 'clientUpdateProhibited',
'serverUpdateProhibited', 'serverUpdateProhibited'
], ],
'pendingTransfer': [ 'pendingTransfer': [
'linked', 'linked',
@ -602,7 +602,7 @@ task statuses: [:environment] do
'clientTransferProhibited', 'clientTransferProhibited',
'serverTransferProhibited', 'serverTransferProhibited',
'clientUpdateProhibited', 'clientUpdateProhibited',
'serverUpdateProhibited', 'serverUpdateProhibited'
], ],
'pendingUpdate': [ 'pendingUpdate': [
'linked', 'linked',
@ -611,13 +611,13 @@ task statuses: [:environment] do
'clientTransferProhibited', 'clientTransferProhibited',
'serverTransferProhibited', 'serverTransferProhibited',
'clientUpdateProhibited', 'clientUpdateProhibited',
'serverUpdateProhibited', 'serverUpdateProhibited'
], ]
} }
puts "\n\nContact status can be with other statuses map\n" puts "\n\nContact status can be with other statuses map\n"
puts "---------------------------------------------" puts "---------------------------------------------"
contact_statuses.each do |s,v| contact_statuses.each do |s, _v|
puts "\n#{s} =>" puts "\n#{s} =>"
contact_statuses[s].map { |u| puts " #{u}" } contact_statuses[s].map { |u| puts " #{u}" }
puts puts

View file

@ -16,15 +16,44 @@ namespace :whois do
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds" puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
end end
# desc 'Delete whois database data and import from Registry master database (faster)' desc 'Create whois database'
# task export: :environment do task create: [:environment] do
# start = Time.zone.now.to_f whois_db = "whois_#{Rails.env}"
# print "-----> Delete whois database data and import from Registry whois_records table..." begin
# whois_records = WhoisRecord.pluck(:name, :body, :json) puts "\n------------------------ Create #{whois_db} ---------------------------------------\n"
# Whois::Record.delete_all ActiveRecord::Base.clear_all_connections!
# Whois::Record.import([:name, :body, :json], whois_records) conf = ActiveRecord::Base.configurations
# puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
# end ActiveRecord::Base.connection.create_database(conf[whois_db]['database'].to_sym, conf[whois_db])
rescue => e
puts "\n#{e}"
end
end
desc 'Drop whois database'
task drop: [:environment] do
# just in case we allow only drop test, comment it out only for temp
if Rails.env.test?
whois_db = "whois_#{Rails.env}"
begin
puts "\n------------------------ #{whois_db} drop ------------------------------\n"
ActiveRecord::Base.clear_all_connections!
ActiveRecord::Base.establish_connection(whois_db.to_sym)
conf = ActiveRecord::Base.configurations
if ActiveRecord::Tasks::DatabaseTasks.drop(conf[whois_db])
puts "#{conf[whois_db]['database']} dropped"
else
puts "Didn't find database #{whois_db}, no drop"
end
rescue => e
puts "\n#{e}"
end
else
puts 'Only for test'
end
end
namespace :schema do namespace :schema do
desc 'Load whois schema into empty whois database' desc 'Load whois schema into empty whois database'

View file

@ -2426,10 +2426,8 @@ describe 'EPP Domain', epp: true do
domain.reload domain.reload
domain.valid_to.should be_within(1).of(exp_date + 1.year) domain.valid_to.should be_within(1).of(exp_date + 1.year)
domain.outzone_at.should be_within(1).of(exp_date + 1.year + Setting.expire_warning_period.days) domain.outzone_at.should be_nil
domain.delete_at.should be_within(1).of( domain.delete_at.should be_nil
exp_date + 1.year + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
@registrar1.balance.should == old_balance - 15.0 @registrar1.balance.should == old_balance - 15.0
@registrar1.cash_account.account_activities.count.should == old_activities + 1 @registrar1.cash_account.account_activities.count.should == old_activities + 1
@ -2485,10 +2483,8 @@ describe 'EPP Domain', epp: true do
domain.reload domain.reload
domain.valid_to.should be_within(1).of(exp_date + 1.year) domain.valid_to.should be_within(1).of(exp_date + 1.year)
domain.outzone_at.should be_within(1).of(exp_date + 1.year + Setting.expire_warning_period.days) domain.outzone_at.should be_nil
domain.delete_at.should be_within(1).of( domain.delete_at.should be_nil
exp_date + 1.year + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
@registrar1.balance.should == old_balance - 15.0 @registrar1.balance.should == old_balance - 15.0
@registrar1.cash_account.account_activities.count.should == old_activities + 1 @registrar1.cash_account.account_activities.count.should == old_activities + 1
@ -2764,10 +2760,8 @@ describe 'EPP Domain', epp: true do
domain.reload domain.reload
domain.valid_to.should be_within(5).of(old_valid_to + 1.year) domain.valid_to.should be_within(5).of(old_valid_to + 1.year)
domain.outzone_at.should be_within(5).of(old_valid_to + 1.year + Setting.expire_warning_period.days) domain.outzone_at.should be_nil
domain.delete_at.should be_within(5).of( domain.delete_at.should be_nil
old_valid_to + 1.year + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
end end
it 'does not renew foreign domain' do it 'does not renew foreign domain' do

View file

@ -1,6 +1,10 @@
require 'rails_helper' require 'rails_helper'
describe ContactMailer do describe ContactMailer do
before :all do
Fabricate(:zonefile_setting, origin: 'ee')
end
describe 'email changed notification when delivery turned off' do describe 'email changed notification when delivery turned off' do
before :all do before :all do
@contact = Fabricate(:contact, email: 'test@example.ee') @contact = Fabricate(:contact, email: 'test@example.ee')
@ -26,7 +30,6 @@ describe ContactMailer do
describe 'email changed notification' do describe 'email changed notification' do
before :all do before :all do
Fabricate(:zonefile_setting, origin: 'ee')
@domain = Fabricate(:domain) @domain = Fabricate(:domain)
@contact = @domain.registrant @contact = @domain.registrant
@contact.reload # until figured out why registrant_domains not loaded @contact.reload # until figured out why registrant_domains not loaded
@ -50,4 +53,30 @@ describe ContactMailer do
@mail.body.encoded.should =~ /Kontaktandmed:/ @mail.body.encoded.should =~ /Kontaktandmed:/
end end
end end
describe 'email with pynicode' do
before :all do
@domain = Fabricate(:domain)
@contact = @domain.registrant
@contact.reload # until figured out why registrant_domains not loaded
@contact.deliver_emails = true
@mail = ContactMailer.email_updated('info@ääöü.org', @contact)
end
it 'should render email subject' do
@mail.subject.should =~ /Teie domeenide kontakt epostiaadress on muutunud/
end
it 'should have sender email' do
@mail.from.should == ["noreply@internet.ee"]
end
it 'should send to info email' do
@mail.to.should == ['info@xn--4caa8cya.org']
end
it 'should render body' do
@mail.body.encoded.should =~ /Kontaktandmed:/
end
end
end end

View file

@ -82,10 +82,8 @@ describe Domain do
it 'should have correct validity dates' do it 'should have correct validity dates' do
valid_to = Time.zone.now + 1.year valid_to = Time.zone.now + 1.year
@domain.valid_to.should be_within(5).of(valid_to) @domain.valid_to.should be_within(5).of(valid_to)
@domain.outzone_at.should be_within(5).of(valid_to + Setting.expire_warning_period.days) @domain.outzone_at.should be_nil
@domain.delete_at.should be_within(5).of( @domain.delete_at.should be_nil
valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
end end
it 'should validate uniqueness of tech contacts' do it 'should validate uniqueness of tech contacts' do
@ -146,18 +144,39 @@ describe Domain do
Domain.start_expire_period Domain.start_expire_period
@domain.statuses.include?(DomainStatus::EXPIRED).should == false @domain.statuses.include?(DomainStatus::EXPIRED).should == false
@domain.valid_to = Time.zone.now - 10.days old_valid_to = Time.zone.now - 10.days
@domain.valid_to = old_valid_to
@domain.save @domain.save
Domain.start_expire_period Domain.start_expire_period
@domain.reload @domain.reload
@domain.statuses.include?(DomainStatus::EXPIRED).should == true @domain.statuses.include?(DomainStatus::EXPIRED).should == true
@domain.outzone_at.should be_within(5).of(old_valid_to + Setting.expire_warning_period.days)
@domain.delete_at.should be_within(5).of(
old_valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
Domain.start_expire_period Domain.start_expire_period
@domain.reload @domain.reload
@domain.statuses.include?(DomainStatus::EXPIRED).should == true @domain.statuses.include?(DomainStatus::EXPIRED).should == true
end end
it 'should start redemption grace period' do
old_valid_to = Time.zone.now - 10.days
@domain.valid_to = old_valid_to
@domain.statuses = [DomainStatus::EXPIRED]
@domain.outzone_at, @domain.delete_at = nil, nil
@domain.save
Domain.start_expire_period
@domain.reload
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
@domain.outzone_at.should be_within(5).of(old_valid_to + Setting.expire_warning_period.days)
@domain.delete_at.should be_within(5).of(
old_valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
)
end
it 'should start redemption grace period' do it 'should start redemption grace period' do
Domain.start_redemption_grace_period Domain.start_redemption_grace_period
@domain.reload @domain.reload

View file

@ -3,7 +3,8 @@ require 'rails_helper'
describe Repp::AccountV1 do describe Repp::AccountV1 do
it 'should fail without whitelisted IP' do it 'should fail without whitelisted IP' do
ENV['webclient_ips'] = '192.188.1.1' ENV['webclient_ips'] = '192.188.1.1'
@registrar1 = Fabricate(:registrar, white_ips: [Fabricate(:white_ip_registrar)]) Setting.api_ip_whitelist_enabled = true
@registrar1 = Fabricate(:registrar, white_ips: [Fabricate(:white_ip_registrar, ipv4: '99.99.99.99')])
@api_user = Fabricate(:api_user, registrar: @registrar1) @api_user = Fabricate(:api_user, registrar: @registrar1)
get_with_auth '/repp/v1/accounts/balance', {}, @api_user get_with_auth '/repp/v1/accounts/balance', {}, @api_user
@ -12,6 +13,7 @@ describe Repp::AccountV1 do
body['error'].should == 'IP is not whitelisted' body['error'].should == 'IP is not whitelisted'
ENV['webclient_ips'] = '127.0.0.1' ENV['webclient_ips'] = '127.0.0.1'
Setting.api_ip_whitelist_enabled = false
end end
context 'with valid registrar' do context 'with valid registrar' do

View file

@ -79,7 +79,7 @@ module Epp
res = parse_response(server.send_request(data)) res = parse_response(server.send_request(data))
if res if res
log(data, res[:parsed]) log(data, res[:raw])
if validate_output && @xsd if validate_output && @xsd
@xsd.validate(Nokogiri(res[:raw])).each do |error| @xsd.validate(Nokogiri(res[:raw])).each do |error|
fail Exception.new, error.to_s fail Exception.new, error.to_s
@ -364,7 +364,7 @@ module Epp
def log(req, res) def log(req, res)
return unless ENV['EPP_DOC'] return unless ENV['EPP_DOC']
puts "REQUEST:\n\n```xml\n#{Nokogiri(req)}```\n\n" puts "REQUEST:\n\n```xml\n#{Nokogiri(req)}```\n\n"
puts "RESPONSE:\n\n```xml\n#{res}```\n\n" puts "RESPONSE:\n\n```xml\n#{Nokogiri(res)}```\n\n"
end end
end end