mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Merge branch 'master' into credit-and-debit-card-payments
This commit is contained in:
commit
d7afb3880a
16 changed files with 245 additions and 62 deletions
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -1,3 +1,18 @@
|
||||||
|
23.04.2018
|
||||||
|
* WHOIS: domains with deleteCandidate status do not return registration details as domains waiting to be deleted [#789](https://github.com/internetee/registry/issues/789)
|
||||||
|
* Security: Nokigiri gem update to version 1.8.2 [#823](https://github.com/internetee/registry/pull/823)
|
||||||
|
* Bug: fixed missing translation error in admin mail templates page [#818](https://github.com/internetee/registry/pull/818)
|
||||||
|
* Admin: VAT percentage info to registrar profile for setting tax rate for foreign non vat liable registrars [#623](https://github.com/internetee/registry/issues/623)
|
||||||
|
* Admin: deleteCandidate status is now stressed in domain details view [#792](https://github.com/internetee/registry/issues/792)
|
||||||
|
* Removed invoice_type from invoice db data as unused [#772](https://github.com/internetee/registry/issues/772)
|
||||||
|
* Removed valid_from from domain db data as duplicated and unused [#787](https://github.com/internetee/registry/issues/787)
|
||||||
|
* Set Not null constraint to valid_ti domain db data [#800](https://github.com/internetee/registry/issues/800)
|
||||||
|
* Removed unused methods [#797](https://github.com/internetee/registry/issues/797)
|
||||||
|
* Removed unused cron tasks [#782](https://github.com/internetee/registry/issues/782)
|
||||||
|
* Removed some monkey-patching for flash message logging [#231](https://github.com/internetee/registry/issues/231)
|
||||||
|
* Added Docker container support for dev and test environments [#821](https://github.com/internetee/registry/issues/821)
|
||||||
|
* Fix for Travis CI random test failures [#809](https://github.com/internetee/registry/pull/809)
|
||||||
|
|
||||||
03.04.2018
|
03.04.2018
|
||||||
* BUG: Fixed bug with sometimes failing bank-link payments [#642](https://github.com/internetee/registry/issues/642)
|
* BUG: Fixed bug with sometimes failing bank-link payments [#642](https://github.com/internetee/registry/issues/642)
|
||||||
* EPP: Domain and associated objects are now validated on domain renew [#678](https://github.com/internetee/registry/issues/678)
|
* EPP: Domain and associated objects are now validated on domain renew [#678](https://github.com/internetee/registry/issues/678)
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -11,7 +11,7 @@ source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'SyslogLogger', '2.0', require: 'syslog/logger'
|
gem 'SyslogLogger', '2.0', require: 'syslog/logger'
|
||||||
gem 'iso8601', '0.8.6' # for dates and times
|
gem 'iso8601', '0.8.6' # for dates and times
|
||||||
gem 'rails', '4.2.7.1' # when update, all initializers eis_custom files needs check/update
|
gem 'rails', '4.2.10' # when update, all initializers eis_custom files needs check/update
|
||||||
gem 'rest-client'
|
gem 'rest-client'
|
||||||
|
|
||||||
# load env
|
# load env
|
||||||
|
|
96
Gemfile.lock
96
Gemfile.lock
|
@ -60,43 +60,42 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
SyslogLogger (2.0)
|
SyslogLogger (2.0)
|
||||||
actionmailer (4.2.7.1)
|
actionmailer (4.2.10)
|
||||||
actionpack (= 4.2.7.1)
|
actionpack (= 4.2.10)
|
||||||
actionview (= 4.2.7.1)
|
actionview (= 4.2.10)
|
||||||
activejob (= 4.2.7.1)
|
activejob (= 4.2.10)
|
||||||
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.7.1)
|
actionpack (4.2.10)
|
||||||
actionview (= 4.2.7.1)
|
actionview (= 4.2.10)
|
||||||
activesupport (= 4.2.7.1)
|
activesupport (= 4.2.10)
|
||||||
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.7.1)
|
actionview (4.2.10)
|
||||||
activesupport (= 4.2.7.1)
|
activesupport (= 4.2.10)
|
||||||
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.3)
|
||||||
active_model-errors_details (1.3.1)
|
active_model-errors_details (1.3.1)
|
||||||
activemodel (>= 3.2.13, < 5.0.0)
|
activemodel (>= 3.2.13, < 5.0.0)
|
||||||
activesupport
|
activesupport
|
||||||
activejob (4.2.7.1)
|
activejob (4.2.10)
|
||||||
activesupport (= 4.2.7.1)
|
activesupport (= 4.2.10)
|
||||||
globalid (>= 0.3.0)
|
globalid (>= 0.3.0)
|
||||||
activemodel (4.2.7.1)
|
activemodel (4.2.10)
|
||||||
activesupport (= 4.2.7.1)
|
activesupport (= 4.2.10)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
activerecord (4.2.7.1)
|
activerecord (4.2.10)
|
||||||
activemodel (= 4.2.7.1)
|
activemodel (= 4.2.10)
|
||||||
activesupport (= 4.2.7.1)
|
activesupport (= 4.2.10)
|
||||||
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.7.1)
|
activesupport (4.2.10)
|
||||||
i18n (~> 0.7)
|
i18n (~> 0.7)
|
||||||
json (~> 1.7, >= 1.7.7)
|
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
thread_safe (~> 0.3, >= 0.3.4)
|
thread_safe (~> 0.3, >= 0.3.4)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
|
@ -160,7 +159,7 @@ GEM
|
||||||
unicode_utils (~> 1.4)
|
unicode_utils (~> 1.4)
|
||||||
crack (0.4.3)
|
crack (0.4.3)
|
||||||
safe_yaml (~> 1.0.0)
|
safe_yaml (~> 1.0.0)
|
||||||
crass (1.0.3)
|
crass (1.0.4)
|
||||||
daemons (1.2.4)
|
daemons (1.2.4)
|
||||||
daemons-rails (1.2.1)
|
daemons-rails (1.2.1)
|
||||||
daemons
|
daemons
|
||||||
|
@ -189,8 +188,8 @@ GEM
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
figaro (1.1.1)
|
figaro (1.1.1)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
globalid (0.3.7)
|
globalid (0.4.1)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.2.0)
|
||||||
grape (0.12.0)
|
grape (0.12.0)
|
||||||
activesupport
|
activesupport
|
||||||
builder
|
builder
|
||||||
|
@ -228,7 +227,7 @@ GEM
|
||||||
httpi (2.4.2)
|
httpi (2.4.2)
|
||||||
rack
|
rack
|
||||||
socksify
|
socksify
|
||||||
i18n (0.8.4)
|
i18n (0.8.6)
|
||||||
i18n_data (0.7.0)
|
i18n_data (0.7.0)
|
||||||
ice_nine (0.11.2)
|
ice_nine (0.11.2)
|
||||||
isikukood (0.1.2)
|
isikukood (0.1.2)
|
||||||
|
@ -251,8 +250,8 @@ GEM
|
||||||
loofah (2.2.2)
|
loofah (2.2.2)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.6.6)
|
mail (2.7.0)
|
||||||
mime-types (>= 1.16, < 4)
|
mini_mime (>= 0.1.1)
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
mime-types (3.1)
|
mime-types (3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
|
@ -260,8 +259,9 @@ GEM
|
||||||
mina (0.3.1)
|
mina (0.3.1)
|
||||||
open4 (~> 1.3.4)
|
open4 (~> 1.3.4)
|
||||||
rake
|
rake
|
||||||
|
mini_mime (1.0.0)
|
||||||
mini_portile2 (2.3.0)
|
mini_portile2 (2.3.0)
|
||||||
minitest (5.10.3)
|
minitest (5.11.3)
|
||||||
monetize (1.6.0)
|
monetize (1.6.0)
|
||||||
money (~> 6.8)
|
money (~> 6.8)
|
||||||
money (6.8.3)
|
money (6.8.3)
|
||||||
|
@ -275,7 +275,7 @@ GEM
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nokogiri (1.8.1)
|
nokogiri (1.8.2)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.3.0)
|
||||||
nori (2.6.0)
|
nori (2.6.0)
|
||||||
open4 (1.3.4)
|
open4 (1.3.4)
|
||||||
|
@ -313,35 +313,35 @@ 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.7.1)
|
rails (4.2.10)
|
||||||
actionmailer (= 4.2.7.1)
|
actionmailer (= 4.2.10)
|
||||||
actionpack (= 4.2.7.1)
|
actionpack (= 4.2.10)
|
||||||
actionview (= 4.2.7.1)
|
actionview (= 4.2.10)
|
||||||
activejob (= 4.2.7.1)
|
activejob (= 4.2.10)
|
||||||
activemodel (= 4.2.7.1)
|
activemodel (= 4.2.10)
|
||||||
activerecord (= 4.2.7.1)
|
activerecord (= 4.2.10)
|
||||||
activesupport (= 4.2.7.1)
|
activesupport (= 4.2.10)
|
||||||
bundler (>= 1.3.0, < 2.0)
|
bundler (>= 1.3.0, < 2.0)
|
||||||
railties (= 4.2.7.1)
|
railties (= 4.2.10)
|
||||||
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.8)
|
rails-dom-testing (1.0.9)
|
||||||
activesupport (>= 4.2.0.beta, < 5.0)
|
activesupport (>= 4.2.0, < 5.0)
|
||||||
nokogiri (~> 1.6)
|
nokogiri (~> 1.6)
|
||||||
rails-deprecated_sanitizer (>= 1.0.1)
|
rails-deprecated_sanitizer (>= 1.0.1)
|
||||||
rails-html-sanitizer (1.0.3)
|
rails-html-sanitizer (1.0.4)
|
||||||
loofah (~> 2.0)
|
loofah (~> 2.2, >= 2.2.2)
|
||||||
rails-settings-cached (0.4.1)
|
rails-settings-cached (0.4.1)
|
||||||
rails (>= 4.0.0)
|
rails (>= 4.0.0)
|
||||||
railties (4.2.7.1)
|
railties (4.2.10)
|
||||||
actionpack (= 4.2.7.1)
|
actionpack (= 4.2.10)
|
||||||
activesupport (= 4.2.7.1)
|
activesupport (= 4.2.10)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rainbow (2.2.2)
|
rainbow (2.2.2)
|
||||||
rake
|
rake
|
||||||
rake (12.0.0)
|
rake (12.3.1)
|
||||||
ransack (1.5.1)
|
ransack (1.5.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activerecord (>= 3.0)
|
activerecord (>= 3.0)
|
||||||
|
@ -430,14 +430,14 @@ GEM
|
||||||
sprockets (3.7.1)
|
sprockets (3.7.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
sprockets-rails (3.2.0)
|
sprockets-rails (3.2.1)
|
||||||
actionpack (>= 4.0)
|
actionpack (>= 4.0)
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 4.0)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
thor (0.19.4)
|
thor (0.20.0)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
tzinfo (1.2.3)
|
tzinfo (1.2.5)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
unf (0.1.4)
|
unf (0.1.4)
|
||||||
unf_ext
|
unf_ext
|
||||||
|
@ -522,7 +522,7 @@ DEPENDENCIES
|
||||||
que-web (= 0.4.0)
|
que-web (= 0.4.0)
|
||||||
que_mailer!
|
que_mailer!
|
||||||
railroady (= 1.3.0)
|
railroady (= 1.3.0)
|
||||||
rails (= 4.2.7.1)
|
rails (= 4.2.10)
|
||||||
rails-settings-cached (= 0.4.1)
|
rails-settings-cached (= 0.4.1)
|
||||||
ransack (= 1.5.1)
|
ransack (= 1.5.1)
|
||||||
rest-client
|
rest-client
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
module Admin
|
module Admin
|
||||||
class ContactVersionsController < BaseController
|
class ContactVersionsController < BaseController
|
||||||
|
include ObjectVersionsHelper
|
||||||
|
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
module Admin
|
module Admin
|
||||||
class DomainVersionsController < BaseController
|
class DomainVersionsController < BaseController
|
||||||
|
include ObjectVersionsHelper
|
||||||
|
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
5
app/helpers/contact_helper.rb
Normal file
5
app/helpers/contact_helper.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module ContactHelper
|
||||||
|
def printable_street(street)
|
||||||
|
street.to_s.gsub("\n", '<br>').html_safe
|
||||||
|
end
|
||||||
|
end
|
15
app/helpers/object_versions_helper.rb
Normal file
15
app/helpers/object_versions_helper.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
module ObjectVersionsHelper
|
||||||
|
def attach_existing_fields(version, new_object)
|
||||||
|
version.object_changes.to_h.each do |key, value|
|
||||||
|
method_name = "#{key}=".to_sym
|
||||||
|
if new_object.respond_to?(method_name)
|
||||||
|
new_object.public_send(method_name, value.last)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def only_present_fields(version, model)
|
||||||
|
field_names = model.column_names
|
||||||
|
version.object.to_h.select { |key, _value| field_names.include?(key) }
|
||||||
|
end
|
||||||
|
end
|
|
@ -23,6 +23,12 @@ class WhoisRecord < ActiveRecord::Base
|
||||||
h = HashWithIndifferentAccess.new
|
h = HashWithIndifferentAccess.new
|
||||||
return h if domain.blank?
|
return h if domain.blank?
|
||||||
|
|
||||||
|
if domain.discarded?
|
||||||
|
h[:name] = domain.name
|
||||||
|
h[:status] = ['deleteCandidate']
|
||||||
|
return h
|
||||||
|
end
|
||||||
|
|
||||||
status_map = {
|
status_map = {
|
||||||
'ok' => 'ok (paid and in zone)'
|
'ok' => 'ok (paid and in zone)'
|
||||||
}
|
}
|
||||||
|
@ -88,7 +94,8 @@ class WhoisRecord < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def generated_body
|
def generated_body
|
||||||
template = Rails.root.join("app/views/for_models/whois.erb".freeze)
|
template_name = domain.discarded? ? 'whois_discarded.erb' : 'whois.erb'
|
||||||
|
template = Rails.root.join("app/views/for_models/#{template_name}".freeze)
|
||||||
ERB.new(template.read, nil, "-").result(binding)
|
ERB.new(template.read, nil, "-").result(binding)
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/MethodLength
|
# rubocop:enable Metrics/MethodLength
|
||||||
|
|
|
@ -57,8 +57,9 @@
|
||||||
%tbody
|
%tbody
|
||||||
- @versions.each do |version|
|
- @versions.each do |version|
|
||||||
- if version
|
- if version
|
||||||
- contact = Contact.new(version.object.to_h)
|
- attributes = only_present_fields(version, Contact)
|
||||||
- version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last) }
|
- contact = Contact.new(attributes)
|
||||||
|
- attach_existing_fields(version, contact)
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td= link_to(contact.name, admin_contact_version_path(version.id))
|
%td= link_to(contact.name, admin_contact_version_path(version.id))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
- contact = Contact.new(@version.object.to_h)
|
- attributes = only_present_fields(@version, Contact)
|
||||||
- @version.object_changes.to_h.each { |k,v| contact.public_send("#{k}=", v.last ) }
|
- contact = Contact.new(attributes)
|
||||||
|
- attach_existing_fields(@version, contact)
|
||||||
= render 'shared/title', name: contact.name
|
= render 'shared/title', name: contact.name
|
||||||
|
|
||||||
.row
|
.row
|
||||||
|
@ -41,11 +42,11 @@
|
||||||
|
|
||||||
%br
|
%br
|
||||||
|
|
||||||
%dt= t(:created)
|
%dt= t(:created_at)
|
||||||
%dd{class: changing_css_class(@version,"created_at")}
|
%dd{class: changing_css_class(@version,"created_at")}
|
||||||
= l(contact.created_at, format: :short)
|
= l(contact.created_at, format: :short)
|
||||||
|
|
||||||
%dt= t(:updated)
|
%dt= t(:updated_at)
|
||||||
%dd{class: changing_css_class(@version,"updated_at")}
|
%dd{class: changing_css_class(@version,"updated_at")}
|
||||||
= l(contact.updated_at, format: :short)
|
= l(contact.updated_at, format: :short)
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@
|
||||||
|
|
||||||
- if contact.street.present?
|
- if contact.street.present?
|
||||||
%dt= t(:street)
|
%dt= t(:street)
|
||||||
%dd{class: changing_css_class(@version,"street")}= contact.street.to_s.gsub("\n", '<br>').html_safe
|
%dd{class: changing_css_class(@version,"street")}= printable_street(contact.street)
|
||||||
|
|
||||||
- if contact.city.present?
|
- if contact.city.present?
|
||||||
%dt= t(:city)
|
%dt= t(:city)
|
||||||
|
|
|
@ -55,8 +55,9 @@
|
||||||
%tbody
|
%tbody
|
||||||
- @versions.each do |version|
|
- @versions.each do |version|
|
||||||
- if version
|
- if version
|
||||||
- domain = Domain.new(version.object.to_h)
|
- attributes = only_present_fields(version, Domain)
|
||||||
- version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) }
|
- domain = Domain.new(attributes)
|
||||||
|
- attach_existing_fields(version, domain)
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td= link_to(domain.name, admin_domain_version_path(version.id))
|
%td= link_to(domain.name, admin_domain_version_path(version.id))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
- domain = Domain.new(@version.object.to_h)
|
- present_fields = only_present_fields(@version, Domain)
|
||||||
- @version.object_changes.to_h.each{|k,v| domain.public_send("#{k}=", v.last) }
|
- domain = Domain.new(present_fields)
|
||||||
|
- attach_existing_fields(@version, domain)
|
||||||
|
|
||||||
- if @version
|
- if @version
|
||||||
- children = HashWithIndifferentAccess.new(@version.children)
|
- children = HashWithIndifferentAccess.new(@version.children)
|
||||||
|
|
8
app/views/for_models/whois_discarded.erb
Normal file
8
app/views/for_models/whois_discarded.erb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
Estonia .ee Top Level Domain WHOIS server
|
||||||
|
|
||||||
|
Domain:
|
||||||
|
name: <%= json['name'] %>
|
||||||
|
status: <%= json['status'] %>
|
||||||
|
|
||||||
|
Estonia .ee Top Level Domain WHOIS server
|
||||||
|
More information at http://internet.ee
|
|
@ -8,7 +8,7 @@
|
||||||
%dd= @contact.org_name
|
%dd= @contact.org_name
|
||||||
|
|
||||||
%dt= t(:street)
|
%dt= t(:street)
|
||||||
%dd= @contact.street.to_s.gsub("\n", '<br>').html_safe
|
%dd= printable_street(@contact.street)
|
||||||
|
|
||||||
%dt= t(:city)
|
%dt= t(:city)
|
||||||
%dd= @contact.city
|
%dd= @contact.city
|
||||||
|
|
60
test/integration/admin/contact_versions_test.rb
Normal file
60
test/integration/admin/contact_versions_test.rb
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ContactVersionsTest < ActionDispatch::IntegrationTest
|
||||||
|
def setup
|
||||||
|
super
|
||||||
|
|
||||||
|
create_contact_with_history
|
||||||
|
login_as users(:admin)
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
super
|
||||||
|
|
||||||
|
delete_objects_once_done
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_contact_with_history
|
||||||
|
sql = <<-SQL.squish
|
||||||
|
INSERT INTO registrars (id, name, reg_no, email, country_code, code,
|
||||||
|
accounting_customer_code, language)
|
||||||
|
VALUES (75, 'test_registrar', 'test123', 'test@test.com', 'EE', 'TEST123',
|
||||||
|
'test123', 'en');
|
||||||
|
|
||||||
|
INSERT INTO contacts (id, code, auth_info, registrar_id)
|
||||||
|
VALUES (75, 'test_code', '8b4d462aa04194ca78840a', 75);
|
||||||
|
|
||||||
|
INSERT INTO log_contacts (item_type, item_id, event, whodunnit, object,
|
||||||
|
object_changes, created_at, session, children, ident_updated_at, uuid)
|
||||||
|
VALUES ('Contact', 75, 'update', '1-AdminUser',
|
||||||
|
'{"id": 75, "code": "test_code", "auth_info": "8b4d462aa04194ca78840a", "registrar_id": 75, "old_field": "value"}',
|
||||||
|
'{"other_made_up_field": "value"}',
|
||||||
|
'2018-04-23 15:50:48.113491', '2018-04-23 12:44:56',
|
||||||
|
'{"legal_documents":[null]}', null, null
|
||||||
|
)
|
||||||
|
SQL
|
||||||
|
|
||||||
|
ActiveRecord::Base.connection.execute(sql)
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_objects_once_done
|
||||||
|
ActiveRecord::Base.connection.execute('DELETE from log_contacts where item_id = 75')
|
||||||
|
Domain.destroy_all
|
||||||
|
Contact.destroy_all
|
||||||
|
Registrar.destroy_all
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_removed_fields_are_not_causing_errors_in_index_view
|
||||||
|
visit admin_contact_versions_path
|
||||||
|
assert_text 'test_registrar'
|
||||||
|
assert_text 'update 23.04.18, 18:50'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_removed_fields_are_not_causing_errors_in_details_view
|
||||||
|
version_id = Contact.find(75).versions.last
|
||||||
|
visit admin_contact_version_path(version_id)
|
||||||
|
|
||||||
|
assert_text 'test_registrar'
|
||||||
|
assert_text '23.04.18, 18:50 update 1-AdminUser'
|
||||||
|
end
|
||||||
|
end
|
65
test/integration/admin/domain_versions_test.rb
Normal file
65
test/integration/admin/domain_versions_test.rb
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class DomainVersionsTest < ActionDispatch::IntegrationTest
|
||||||
|
def setup
|
||||||
|
super
|
||||||
|
|
||||||
|
create_domain_with_history
|
||||||
|
login_as users(:admin)
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
super
|
||||||
|
|
||||||
|
delete_objects_once_done
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_domain_with_history
|
||||||
|
sql = <<-SQL.squish
|
||||||
|
INSERT INTO registrars (id, name, reg_no, email, country_code, code,
|
||||||
|
accounting_customer_code, language)
|
||||||
|
VALUES (54, 'test_registrar', 'test123', 'test@test.com', 'EE', 'TEST123',
|
||||||
|
'test123', 'en');
|
||||||
|
|
||||||
|
INSERT INTO contacts (id, code, auth_info, registrar_id)
|
||||||
|
VALUES (54, 'test_code', '8b4d462aa04194ca78840a', 54);
|
||||||
|
|
||||||
|
INSERT INTO domains (id, registrar_id, valid_to, registrant_id,
|
||||||
|
transfer_code)
|
||||||
|
VALUES (54, 54, '2018-06-23T12:14:02.732+03:00', 54, 'transfer_code');
|
||||||
|
|
||||||
|
INSERT INTO log_domains (item_type, item_id, event, whodunnit, object,
|
||||||
|
object_changes, created_at, nameserver_ids, tech_contact_ids,
|
||||||
|
admin_contact_ids, session, children)
|
||||||
|
VALUES ('Domain', 54, 'update', '1-AdminUser',
|
||||||
|
'{"id": 54, "registrar_id": 54, "valid_to": "2018-07-23T12:14:05.583+03:00", "registrant_id": 54, "transfer_code": "transfer_code", "valid_from": "2017-07-23T12:14:05.583+03:00"}',
|
||||||
|
'{"foo": "bar", "other_made_up_field": "value"}',
|
||||||
|
'2018-04-23 15:50:48.113491', '{}', '{}', '{}', '2018-04-23 12:44:56',
|
||||||
|
'{"null_fracdmin_contacts":[108],"tech_contacts":[109],"nameservers":[],"dnskeys":[],"legal_documents":[null],"registrant":[1]}'
|
||||||
|
)
|
||||||
|
SQL
|
||||||
|
ActiveRecord::Base.connection.execute(sql)
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_objects_once_done
|
||||||
|
ActiveRecord::Base.connection.execute('DELETE FROM log_domains where item_id = 54')
|
||||||
|
Domain.destroy_all
|
||||||
|
Contact.destroy_all
|
||||||
|
Registrar.destroy_all
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_removed_fields_are_not_causing_errors_in_index_view
|
||||||
|
visit admin_domain_versions_path
|
||||||
|
|
||||||
|
assert_text 'test_registrar'
|
||||||
|
assert_text 'test_registrar update 23.04.18, 18:50'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_removed_fields_are_not_causing_errors_in_details_view
|
||||||
|
version_id = Domain.find(54).versions.last
|
||||||
|
visit admin_domain_version_path(version_id)
|
||||||
|
|
||||||
|
assert_text 'test_registrar'
|
||||||
|
assert_text '23.04.18, 18:50 update 1-AdminUser'
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue