diff --git a/.codeclimate.yml b/.codeclimate.yml
index 5a9b41ea73..3802e689be 100644
--- a/.codeclimate.yml
+++ b/.codeclimate.yml
@@ -1,7 +1,9 @@
version: "2"
prepare:
fetch:
- - "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop.yml"
+ - "https://raw.githubusercontent.com/internetee/style-guide/master/.rubocop-ruby.yml"
+ - url: "https://raw.githubusercontent.com/internetee/style-guide/master/.rubocop-rails.yml"
+ path: ".rubocop.yml"
plugins:
brakeman:
enabled: true
@@ -20,9 +22,8 @@ plugins:
enabled: true
rubocop:
enabled: true
- channel: rubocop-0-58
+ channel: rubocop-0-74
exclude_patterns:
- - "app/models/legacy/"
- "app/models/version/"
- "bin/"
- "config/"
@@ -35,7 +36,6 @@ exclude_patterns:
- "lib/tasks/bootstrap.rake"
- "lib/tasks/db.rake"
- "lib/tasks/documents.rake"
- - "lib/tasks/import.rake"
- "lib/tasks/legal_doc.rake"
- "lib/tasks/whois.rake"
- "test/"
diff --git a/.editorconfig b/.editorconfig
index 5f4df341d4..95ad0d2d58 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,7 +7,7 @@ indent_style = space
indent_size = 2
max_line_length = 100
trim_trailing_whitespace = true
-insert_final_newline = false
+insert_final_newline = true
-[*.{html,erb}]
+[*.{html,erb,js}]
indent_size = 4
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85e4197ce9..d1fd0ab163 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,34 @@
+28.10.2019
+* Updated kaminari gem to 1.1.1 [#1392](https://github.com/internetee/registry/pull/1392)
+* Downgraded minitest to 5.10.3 due to incompatibility with Rails 5.0 [#1387](https://github.com/internetee/registry/pull/1387)
+* New db constaints to invoices and invoice_items tables [#1388](https://github.com/internetee/registry/pull/1388)
+* Removed buggy code for contact details' fast access in regitrar portal [#1386](https://github.com/internetee/registry/pull/1386)
+
+23.10.2019
+* Updated haml gem to 5.1.2 (CVE-2017-1002201) [#1384](https://github.com/internetee/registry/pull/1384)
+* Removed bullet gem [#378](https://github.com/internetee/registry/issues/378)
+* Removed duplicate route from admin [#1375](https://github.com/internetee/registry/pull/1375)
+
+21.10.2019
+* Tuned PDFkit gem [#1367](https://github.com/internetee/registry/pull/1367)
+* Removed some dead code [#1370](https://github.com/internetee/registry/pull/1370)
+
+17.10.2019
+* Implemented properl handling of contact transfer requests [#1363](https://github.com/internetee/registry/pull/1363)
+* Test environment tuning [#1366](https://github.com/internetee/registry/pull/1366)
+
+16.10.2019
+* Contact and domain list download in portals changed - buttons in stead of dropdown [#1360](https://github.com/internetee/registry/pull/1360)
+* limited epp routes [#1364](https://github.com/internetee/registry/pull/1364)
+
+11.10.2019
+* Fixed mailer previews for couple email templates [#1342](https://github.com/internetee/registry/pull/1342)
+* Updated ransack gem to 1.8 [#1357](https://github.com/internetee/registry/pull/1357)
+* Removed old import rake task [#1355](https://github.com/internetee/registry/pull/1355)
+
+10.10.2019
+* Added DB constraints for reserved and blocked tables [#1338](https://github.com/internetee/registry/pull/1338)
+
08.10.2019
* Removed unused epp routes [#1335](https://github.com/internetee/registry/pull/1335)
* Removed Rspec and coverted specs to tests [#1336](https://github.com/internetee/registry/pull/1336)
diff --git a/Dockerfile b/Dockerfile
index b5871bfed1..7e3b11d804 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,4 @@
FROM internetee/ruby:2.4
-MAINTAINER maciej.szlosarczyk@internet.ee
RUN mkdir -p /opt/webapps/app/tmp/pids
WORKDIR /opt/webapps/app
diff --git a/Gemfile b/Gemfile
index d855cb751c..8660fa47ae 100644
--- a/Gemfile
+++ b/Gemfile
@@ -18,7 +18,8 @@ gem 'figaro', '1.1.1'
# model related
gem 'pg', '0.19.0'
-gem 'ransack', '1.5.1' # for searching
+# 1.8 is for Rails < 5.0
+gem 'ransack', '~> 1.8'
gem 'validates_email_format_of', '1.6.3' # validates email against RFC 2822 and RFC 3696
gem 'paper_trail', '~> 4.0'
@@ -33,9 +34,7 @@ gem 'sass-rails', '5.0.6' # sass style
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'selectize-rails', '0.12.1' # include selectize.js for select
-
-# view helpers
-gem 'kaminari', '0.16.3' # pagination
+gem 'kaminari'
gem 'coderay', '1.1.0' # xml console visualize
gem 'select2-rails', '3.5.9.3' # for autocomplete
gem 'cancancan'
@@ -68,10 +67,6 @@ gem 'uuidtools', '2.1.5' # For unique IDs (used by the epp gem)
gem 'que', '0.10.0'
gem 'daemons-rails', '1.2.1'
gem 'que-web', '0.4.0'
-
-# for importing legacy db
-gem 'activerecord-import', '0.7.0' # for inserting dummy data
-
gem 'pdfkit'
gem 'jquery-ui-rails', '5.0.5'
gem 'active_model-errors_details' # Backport from Rails 5, https://github.com/rails/rails/pull/18322
@@ -81,7 +76,8 @@ gem 'company_register', github: 'internetee/company_register', branch: :master
gem 'e_invoice', github: 'internetee/e_invoice', branch: :master
gem 'lhv', github: 'internetee/lhv', tag: 'v0.1.0'
gem 'domain_name'
-gem 'haml'
+gem 'haml', '~> 5.0'
+gem 'wkhtmltopdf-binary'
group :development do
# deploy
@@ -89,13 +85,7 @@ group :development do
end
group :development, :test do
- gem 'capybara'
- gem 'selenium-webdriver'
-
- # debug
gem 'pry', '0.10.1'
-
- gem 'bullet', '4.14.7' # for finding database optimizations
gem 'sdoc', '0.4.1' # bundle exec rake doc:rails generates the API under doc/api.
gem 'railroady', '1.3.0' # to generate database diagrams
gem 'autodoc'
@@ -103,7 +93,10 @@ group :development, :test do
end
group :test do
+ gem 'capybara'
gem 'database_cleaner'
gem 'simplecov', require: false
+ gem 'webdrivers'
gem 'webmock'
+ gem 'minitest', '~> 5.10.0'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index c56fb00b87..b414b4ec15 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -89,15 +89,13 @@ GEM
activemodel (= 4.2.11.1)
activesupport (= 4.2.11.1)
arel (~> 6.0)
- activerecord-import (0.7.0)
- activerecord (>= 3.0)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
- addressable (2.6.0)
- public_suffix (>= 2.0.2, < 4.0)
+ addressable (2.7.0)
+ public_suffix (>= 2.0.2, < 5.0)
airbrake (9.4.3)
airbrake-ruby (~> 4.6)
airbrake-ruby (4.6.0)
@@ -121,11 +119,8 @@ GEM
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.3)
- bullet (4.14.7)
- activesupport (>= 3.0.0)
- uniform_notifier (~> 1.9.0)
cancancan (3.0.1)
- capybara (3.22.0)
+ capybara (3.29.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
@@ -133,8 +128,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
xpath (~> 3.2)
- childprocess (0.9.0)
- ffi (~> 1.0, >= 1.0.11)
+ childprocess (3.0.0)
chronic (0.10.2)
coderay (1.1.0)
coercible (1.0.0)
@@ -153,7 +147,7 @@ GEM
unicode_utils (~> 1.4)
crack (0.4.3)
safe_yaml (~> 1.0.0)
- crass (1.0.4)
+ crass (1.0.5)
daemons (1.2.4)
daemons-rails (1.2.1)
daemons
@@ -170,7 +164,7 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.3)
- docile (1.3.1)
+ docile (1.3.2)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
equalizer (0.0.11)
@@ -190,7 +184,8 @@ GEM
virtus (>= 1.0.0)
gyoku (1.3.1)
builder (>= 2.1.2)
- haml (4.0.7)
+ haml (5.1.2)
+ temple (>= 0.8.0)
tilt
hashdiff (1.0.0)
hpricot (0.8.6)
@@ -213,12 +208,21 @@ GEM
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
json (1.8.6)
- kaminari (0.16.3)
- actionpack (>= 3.0.0)
- activesupport (>= 3.0.0)
+ kaminari (1.1.1)
+ activesupport (>= 4.1.0)
+ kaminari-actionview (= 1.1.1)
+ kaminari-activerecord (= 1.1.1)
+ kaminari-core (= 1.1.1)
+ kaminari-actionview (1.1.1)
+ actionview
+ kaminari-core (= 1.1.1)
+ kaminari-activerecord (1.1.1)
+ activerecord
+ kaminari-core (= 1.1.1)
+ kaminari-core (1.1.1)
keystores (0.4.0)
libxml-ruby (3.0.0)
- loofah (2.2.3)
+ loofah (2.3.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
@@ -232,7 +236,7 @@ GEM
rake
mini_mime (1.0.2)
mini_portile2 (2.4.0)
- minitest (5.11.3)
+ minitest (5.10.3)
monetize (1.9.0)
money (~> 6.12)
money (6.12.0)
@@ -247,6 +251,7 @@ GEM
mustermann-grape (1.0.0)
mustermann (~> 1.0.0)
netrc (0.11.0)
+ nio4r (2.5.2)
nokogiri (1.10.4)
mini_portile2 (~> 2.4.0)
nori (2.6.0)
@@ -258,14 +263,13 @@ GEM
request_store (~> 1.1)
pdfkit (0.8.4.1)
pg (0.19.0)
- polyamorous (1.3.1)
- activerecord (>= 3.0)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
- public_suffix (3.1.0)
- puma (3.12.1)
+ public_suffix (4.0.1)
+ puma (4.2.1)
+ nio4r (~> 2.0)
que (0.10.0)
que-web (0.4.0)
erubis
@@ -296,8 +300,8 @@ GEM
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
- rails-html-sanitizer (1.2.0)
- loofah (~> 2.2, >= 2.2.2)
+ rails-html-sanitizer (1.3.0)
+ loofah (~> 2.3)
rails-settings-cached (0.7.2)
rails (>= 4.2.0)
railties (4.2.11.1)
@@ -306,15 +310,14 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.3)
- ransack (1.5.1)
- actionpack (>= 3.0)
- activerecord (>= 3.0)
- activesupport (>= 3.0)
+ ransack (1.8.10)
+ actionpack (>= 3.0, < 5.2)
+ activerecord (>= 3.0, < 5.2)
+ activesupport (>= 3.0, < 5.2)
i18n
- polyamorous (~> 1.1)
rbtree3 (0.5.0)
rdoc (4.3.0)
- regexp_parser (1.5.1)
+ regexp_parser (1.6.0)
request_store (1.4.1)
rack (>= 1.4)
responders (2.4.1)
@@ -337,7 +340,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
- rubyzip (1.3.0)
+ rubyzip (2.0.0)
safe_yaml (1.0.5)
sass (3.4.23)
sass-rails (5.0.6)
@@ -363,10 +366,10 @@ GEM
select2-rails (3.5.9.3)
thor (~> 0.14)
selectize-rails (0.12.1)
- selenium-webdriver (3.13.0)
- childprocess (~> 0.5)
- rubyzip (~> 1.2)
- simplecov (0.16.1)
+ selenium-webdriver (3.142.6)
+ childprocess (>= 0.5, < 4.0)
+ rubyzip (>= 1.2.2)
+ simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
@@ -386,9 +389,10 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
+ temple (0.8.2)
thor (0.20.3)
thread_safe (0.3.6)
- tilt (1.4.1)
+ tilt (2.0.10)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.11)
@@ -397,7 +401,6 @@ GEM
unf_ext
unf_ext (0.0.7.2)
unicode_utils (1.4.0)
- uniform_notifier (1.9.0)
uuidtools (2.1.5)
validates_email_format_of (1.6.3)
i18n
@@ -411,12 +414,17 @@ GEM
wasabi (3.5.0)
httpi (~> 2.0)
nokogiri (>= 1.4.2)
+ webdrivers (4.1.3)
+ nokogiri (~> 1.6)
+ rubyzip (>= 1.3.0)
+ selenium-webdriver (>= 3.0, < 4.0)
webmock (3.6.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
whenever (0.9.4)
chronic (>= 0.6.3)
+ wkhtmltopdf-binary (0.12.4)
xpath (3.2.0)
nokogiri (~> 1.8)
@@ -425,11 +433,9 @@ PLATFORMS
DEPENDENCIES
active_model-errors_details
- activerecord-import (= 0.7.0)
airbrake
autodoc
bootstrap-sass (~> 3.4)
- bullet (= 4.14.7)
cancancan
capybara
coderay (= 1.1.0)
@@ -447,14 +453,15 @@ DEPENDENCIES
epp-xml (= 1.1.0)!
figaro (= 1.1.1)
grape
- haml
+ haml (~> 5.0)
isikukood
iso8601 (= 0.8.6)
jquery-rails
jquery-ui-rails (= 5.0.5)
- kaminari (= 0.16.3)
+ kaminari
lhv!
mina (= 0.3.1)
+ minitest (~> 5.10.0)
money-rails
nokogiri
paper_trail (~> 4.0)
@@ -467,20 +474,21 @@ DEPENDENCIES
railroady (= 1.3.0)
rails (= 4.2.11.1)
rails-settings-cached (= 0.7.2)
- ransack (= 1.5.1)
+ ransack (~> 1.8)
rest-client
sass-rails (= 5.0.6)
sdoc (= 0.4.1)
select2-rails (= 3.5.9.3)
selectize-rails (= 0.12.1)
- selenium-webdriver
simplecov
simpleidn (= 0.0.7)
uglifier
uuidtools (= 2.1.5)
validates_email_format_of (= 1.6.3)
+ webdrivers
webmock
whenever (= 0.9.4)
+ wkhtmltopdf-binary
BUNDLED WITH
1.17.3
diff --git a/app/assets/stylesheets/admin/admin.sass b/app/assets/stylesheets/admin/admin.sass
index fe9b569ffb..ddb3fe673f 100644
--- a/app/assets/stylesheets/admin/admin.sass
+++ b/app/assets/stylesheets/admin/admin.sass
@@ -133,12 +133,6 @@ body.login
padding-top: 40px
padding-bottom: 40px
- .form-signin
- .form-signin-heading,
- .form-signin
- .checkbox
- margin-bottom: 10px
-
.form-signin
max-width: 330px
padding: 15px
diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb
index 32b2050ca3..b6a26a6263 100644
--- a/app/controllers/epp/contacts_controller.rb
+++ b/app/controllers/epp/contacts_controller.rb
@@ -76,6 +76,12 @@ def renew
handle_errors
end
+ def transfer
+ authorize! :transfer, Epp::Contact
+ epp_errors << { code: '2101', msg: t(:'errors.messages.unimplemented_command') }
+ handle_errors
+ end
+
private
def find_password
diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb
index 2f31f7e5e7..2b708d66c0 100644
--- a/app/controllers/epp/domains_controller.rb
+++ b/app/controllers/epp/domains_controller.rb
@@ -115,8 +115,6 @@ def update
def delete
authorize! :delete, @domain, @password
- # all includes for bullet
- @domain = Epp::Domain.where(id: @domain.id).includes(nameservers: :versions).first
handle_errors(@domain) and return unless @domain.can_be_deleted?
diff --git a/app/controllers/registrant/domains_controller.rb b/app/controllers/registrant/domains_controller.rb
index b8cd8f37a3..fc66806e25 100644
--- a/app/controllers/registrant/domains_controller.rb
+++ b/app/controllers/registrant/domains_controller.rb
@@ -4,11 +4,29 @@ def index
params[:q] ||= {}
normalize_search_parameters do
- @q = current_user_domains.search(params[:q])
- @domains = @q.result.page(params[:page])
+ @q = current_user_domains.search(search_params)
end
- @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
+ domains = @q.result
+
+ respond_to do |format|
+ format.html do
+ @domains = domains.page(params[:page])
+ domains_per_page = params[:results_per_page].to_i
+ @domains = @domains.per(domains_per_page) if domains_per_page.positive?
+ end
+ format.csv do
+ raw_csv = @q.result.to_csv
+ send_data raw_csv, filename: 'domains.csv', type: "#{Mime[:csv]}; charset=utf-8"
+ end
+ format.pdf do
+ view = ActionView::Base.new(ActionController::Base.view_paths, domains: domains)
+ raw_html = view.render(file: 'registrant/domains/list_pdf', layout: false)
+ raw_pdf = domains.pdf(raw_html)
+
+ send_data raw_pdf, filename: 'domains.pdf'
+ end
+ end
end
def show
@@ -32,23 +50,6 @@ def confirmation
end
end
- def download_list
- authorize! :view, :registrant_domains
- params[:q] ||= {}
- normalize_search_parameters do
- @q = current_user_domains.search(params[:q])
- @domains = @q
- end
-
- respond_to do |format|
- format.csv { render text: @domains.result.to_csv }
- format.pdf do
- pdf = @domains.result.pdf(render_to_string('registrant/domains/download_list', layout: false))
- send_data pdf, filename: 'domains.pdf'
- end
- end
- end
-
private
def normalize_search_parameters
@@ -70,4 +71,9 @@ def confirmation_url(domain)
registrant_domain_delete_confirm_url(token: domain.registrant_verification_token)
end
end
+
+ def search_params
+ params.require(:q).permit(:name_matches, :registrant_ident_eq, :valid_to_gteq, :valid_to_lteq,
+ :results_per_page)
+ end
end
\ No newline at end of file
diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb
index f343f9bfb5..49569d7a00 100644
--- a/app/controllers/registrar/contacts_controller.rb
+++ b/app/controllers/registrar/contacts_controller.rb
@@ -16,10 +16,6 @@ def index
search_params[:registrant_domains_id_not_null] = 1
end
- if search_params.length == 1 && search_params[:name_matches].present?
- @contacts = Contact.find_by(name: search_params[:name_matches])
- end
-
if params[:statuses_contains]
contacts = current_registrar_user.registrar.contacts.includes(:registrar).where(
"contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
@@ -30,37 +26,29 @@ def index
normalize_search_parameters do
@q = contacts.search(search_params)
- @contacts = @q.result(distinct: :true).page(params[:page])
end
- @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
- end
-
- def download_list
- authorize! :view, Depp::Contact
-
- params[:q] ||= {}
- params[:q].delete_if { |_k, v| v.blank? }
- if params[:q].length == 1 && params[:q][:name_matches].present?
- @contacts = Contact.find_by(name: params[:q][:name_matches])
- end
-
- contacts = current_registrar_user.registrar.contacts.includes(:registrar)
- contacts = contacts.filter_by_states(params[:statuses_contains]) if params[:statuses_contains]
-
- normalize_search_parameters do
- @q = contacts.search(params[:q])
- @contacts = @q.result
- end
+ contacts = @q.result
respond_to do |format|
- format.csv { render text: @contacts.to_csv }
+ format.html do
+ contacts_per_page = params[:results_per_page].to_i
+ @contacts = contacts.page(params[:page])
+ @contacts = @contacts.per(contacts_per_page) if contacts_per_page.positive?
+ end
+ format.csv do
+ raw_csv = contacts.to_csv
+ send_data raw_csv, filename: 'contacts.csv', type: "#{Mime[:csv]}; charset=utf-8"
+ end
format.pdf do
- pdf = @contacts.pdf(render_to_string('registrar/contacts/download_list', layout: false))
- send_data pdf, filename: 'contacts.pdf'
+ view = ActionView::Base.new(ActionController::Base.view_paths, contacts: contacts)
+ view.class_eval { include ::ApplicationHelper }
+ raw_html = view.render(file: 'registrar/contacts/list_pdf', layout: false)
+ raw_pdf = contacts.pdf(raw_html)
+
+ send_data raw_pdf, filename: 'contacts.pdf'
end
end
-
end
def new
diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb
index d2969bb69b..bdab2eefc7 100644
--- a/app/controllers/registrar/domains_controller.rb
+++ b/app/controllers/registrar/domains_controller.rb
@@ -47,9 +47,10 @@ def index
domain_presenters << ::DomainPresenter.new(domain: domain, view: view_context)
end
- csv = Registrar::DomainListCSVPresenter.new(domains: domain_presenters, view: view_context).to_s
+ raw_csv = Registrar::DomainListCSVPresenter.new(domains: domain_presenters,
+ view: view_context).to_s
filename = "Domains_#{l(Time.zone.now, format: :filename)}.csv"
- send_data(csv, filename: filename)
+ send_data raw_csv, filename: filename, type: "#{Mime[:csv]}; charset=utf-8"
end
end
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 706d851801..3eab0569a7 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -64,6 +64,7 @@ def epp # Registrar/api_user dynamic role
can(:update, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
can(:delete, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
can(:renew, Epp::Contact)
+ can(:transfer, Epp::Contact)
can(:view_password, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw }
end
diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb
index 19933a5ebb..ae08bcb2ea 100644
--- a/app/models/epp/domain.rb
+++ b/app/models/epp/domain.rb
@@ -23,12 +23,8 @@ def validate_contacts
active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? }
active_techs = tech_domain_contacts.select { |x| !x.marked_for_destruction? }
- # bullet workaround
- ac = active_admins.map { |x| Contact.find(x.contact_id) }
- tc = active_techs.map { |x| Contact.find(x.contact_id) }
-
# validate registrant here as well
- ([registrant] + ac + tc).each do |x|
+ ([registrant] + active_admins + active_techs).each do |x|
unless x.valid?
add_epp_error('2304', nil, nil, I18n.t(:contact_is_not_valid, value: x.code))
ok = false
@@ -123,9 +119,8 @@ def epp_code_map
def attach_default_contacts
return if registrant.blank?
- regt = Registrant.find(registrant.id) # temp for bullet
- tech_contacts << regt if tech_domain_contacts.blank?
- admin_contacts << regt if admin_domain_contacts.blank? && !regt.org?
+ tech_contacts << registrant if tech_domain_contacts.blank?
+ admin_contacts << registrant if admin_domain_contacts.blank? && !registrant.org?
end
def attrs_from(frame, current_user, action = nil)
diff --git a/app/models/epp/response/result/code.rb b/app/models/epp/response/result/code.rb
index 403f67435f..2a65f67471 100644
--- a/app/models/epp/response/result/code.rb
+++ b/app/models/epp/response/result/code.rb
@@ -16,6 +16,7 @@ class Code
required_parameter_missing: 2003,
parameter_value_range_error: 2004,
parameter_value_syntax_error: 2005,
+ unimplemented: 2101,
billing_failure: 2104,
object_is_not_eligible_for_renewal: 2105,
object_is_not_eligible_for_transfer: 2106,
@@ -43,6 +44,7 @@ class Code
2003 => 'Required parameter missing',
2004 => 'Parameter value range error',
2005 => 'Parameter value syntax error',
+ 2101 => 'Unimplemented command',
2104 => 'Billing failure',
2105 => 'Object is not eligible for renewal',
2106 => 'Object is not eligible for transfer',
diff --git a/app/models/legacy/contact.rb b/app/models/legacy/contact.rb
deleted file mode 100644
index 04f8c34a4b..0000000000
--- a/app/models/legacy/contact.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Legacy
- class Contact < Db
- self.table_name = :contact
- belongs_to :object_registry, foreign_key: :id
- belongs_to :object, foreign_key: :id
-
- has_one :object_state, -> { where('valid_to IS NULL') }, foreign_key: :object_id
- end
-end
diff --git a/app/models/legacy/db.rb b/app/models/legacy/db.rb
deleted file mode 100644
index 1cb635b3b9..0000000000
--- a/app/models/legacy/db.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Legacy
- class Db < ActiveRecord::Base
- self.abstract_class = true
- begin
- establish_connection :fred
- rescue ActiveRecord::AdapterNotSpecified => e
- logger.info "Legacy 'fred' database support is currently disabled because #{e}"
- end
-
- def readonly?
- true
- end
- end
-end
diff --git a/app/models/legacy/dnskey.rb b/app/models/legacy/dnskey.rb
deleted file mode 100644
index 3fa47f48b9..0000000000
--- a/app/models/legacy/dnskey.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module Legacy
- class Dnskey < Db
- self.table_name = :dnskey
-
- belongs_to :object_registry, foreign_key: :id
- belongs_to :object, foreign_key: :id
- end
-end
diff --git a/app/models/legacy/domain.rb b/app/models/legacy/domain.rb
deleted file mode 100644
index d0a05d1780..0000000000
--- a/app/models/legacy/domain.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module Legacy
- class Domain < Db
- self.table_name = :domain
-
- belongs_to :object_registry, foreign_key: :id
- belongs_to :object, foreign_key: :id
- belongs_to :nsset, foreign_key: :nsset
- # belongs_to :registrant, foreign_key: :registrant, primary_key: :legacy_id, class_name: '::Contact'
-
- has_many :object_states, -> { where('valid_to IS NULL') }, foreign_key: :object_id
- has_many :dnskeys, foreign_key: :keysetid, primary_key: :keyset
- has_many :domain_contact_maps, foreign_key: :domainid
- has_many :nsset_contact_maps, foreign_key: :nssetid, primary_key: :nsset
- has_many :domain_histories, foreign_key: :id
- end
-end
diff --git a/app/models/legacy/domain_contact_map.rb b/app/models/legacy/domain_contact_map.rb
deleted file mode 100644
index 4e645ed7fd..0000000000
--- a/app/models/legacy/domain_contact_map.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module Legacy
- class DomainContactMap < Db
- self.table_name = :domain_contact_map
-
- # belongs_to :contact, foreign_key: :contactid, primary_key: :legacy_id, class_name: '::Contact'
- end
-end
diff --git a/app/models/legacy/domain_history.rb b/app/models/legacy/domain_history.rb
deleted file mode 100644
index 234585ac39..0000000000
--- a/app/models/legacy/domain_history.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module Legacy
- class DomainHistory < Db
- self.table_name = :domain_history
-
- belongs_to :domain, foreign_key: :id
- end
-end
diff --git a/app/models/legacy/enum_object_state.rb b/app/models/legacy/enum_object_state.rb
deleted file mode 100644
index 00a0968900..0000000000
--- a/app/models/legacy/enum_object_state.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module Legacy
- class EnumObjectState < Db
- self.table_name = :enum_object_states
- end
-end
diff --git a/app/models/legacy/host.rb b/app/models/legacy/host.rb
deleted file mode 100644
index 4c4eeab099..0000000000
--- a/app/models/legacy/host.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module Legacy
- class Host < Db
- self.table_name = :host
-
- has_many :host_ipaddr_maps, foreign_key: :hostid
- end
-end
diff --git a/app/models/legacy/host_ipaddr_map.rb b/app/models/legacy/host_ipaddr_map.rb
deleted file mode 100644
index a4dc2f14e8..0000000000
--- a/app/models/legacy/host_ipaddr_map.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module Legacy
- class HostIpaddrMap < Db
- self.table_name = :host_ipaddr_map
- end
-end
diff --git a/app/models/legacy/invoice.rb b/app/models/legacy/invoice.rb
deleted file mode 100644
index 15441d89ee..0000000000
--- a/app/models/legacy/invoice.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module Legacy
- class Invoice < Db
- self.table_name = :invoice
- end
-end
diff --git a/app/models/legacy/nsset.rb b/app/models/legacy/nsset.rb
deleted file mode 100644
index 515e9f9a93..0000000000
--- a/app/models/legacy/nsset.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Legacy
- class Nsset < Db
- self.table_name = :nsset
-
- belongs_to :object, foreign_key: :id
- belongs_to :object_registry, foreign_key: :id
- has_many :hosts, foreign_key: :nssetid
- end
-end
diff --git a/app/models/legacy/nsset_contact_map.rb b/app/models/legacy/nsset_contact_map.rb
deleted file mode 100644
index f7e0a105bf..0000000000
--- a/app/models/legacy/nsset_contact_map.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module Legacy
- class NssetContactMap < Db
- self.table_name = :nsset_contact_map
- end
-end
diff --git a/app/models/legacy/object.rb b/app/models/legacy/object.rb
deleted file mode 100644
index 04218cd095..0000000000
--- a/app/models/legacy/object.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-module Legacy
- class Object < Db
- self.table_name = :object
- belongs_to :registrar, foreign_key: :upid, primary_key: :legacy_id, class_name: '::Registrar'
-
- def self.instance_method_already_implemented?(method_name)
- return true if method_name == 'update'
- super
- end
- end
-end
diff --git a/app/models/legacy/object_history.rb b/app/models/legacy/object_history.rb
deleted file mode 100644
index 35115b4d59..0000000000
--- a/app/models/legacy/object_history.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-module Legacy
- class ObjectHistory < Db
- self.table_name = :object_history
-
- belongs_to :object_registry, foreign_key: :historyid
-
- def self.instance_method_already_implemented?(method_name)
- return true if method_name == 'update'
- super
- end
- end
-end
diff --git a/app/models/legacy/object_registry.rb b/app/models/legacy/object_registry.rb
deleted file mode 100644
index 96a6fc6e6b..0000000000
--- a/app/models/legacy/object_registry.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module Legacy
- class ObjectRegistry < Db
- self.table_name = :object_registry
- self.inheritance_column = nil
- belongs_to :registrar, foreign_key: :crid, primary_key: :legacy_id, class_name: '::Registrar'
- belongs_to :object_history, foreign_key: :historyid
- end
-end
diff --git a/app/models/legacy/object_state.rb b/app/models/legacy/object_state.rb
deleted file mode 100644
index 379d4d175b..0000000000
--- a/app/models/legacy/object_state.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-module Legacy
- class ObjectState < Db
- self.table_name = :object_state
-
- # legacy values. Just for log
- # 2 => "serverRenewProhibited",
- # 5 => "serverOutzoneManual",
- # 6 => "serverInzoneManual",
- # 7 => "serverBlocked",
- # 8 => "expirationWarning",
- # 9 => "expired",
- # 10 => "unguarded",
- # 11 => "validationWarning1",
- # 12 => "validationWarning2",
- # 13 => "notValidated",
- # 14 => "nssetMissing",
- # 15 => "outzone",
- # 18 => "serverRegistrantChangeProhibited",
- # 19 => "deleteWarning",
- # 20 => "outzoneUnguarded",
- # 1 => "serverDeleteProhibited",
- # 3 => "serverTransferProhibited",
- # 4 => "serverUpdateProhibited",
- # 16 => "linked",
- # 17 => "deleteCandidate",
- # 21 => "forceDelete"
-
- # new values
- STATE_NAMES = {
- 2 => "serverRenewProhibited",
- 5 => "serverHold",
- 6 => "serverManualInzone",
- # 7 => "serverBlocked",
- 9 => "expired",
- # 11 => "validationWarning1",
- # 13 => "notValidated",
- 14 => "inactive",
- 15 => "serverHold",
- 18 => "serverRegistrantChangeProhibited",
- 1 => "serverDeleteProhibited",
- 3 => "serverTransferProhibited",
- 4 => "serverUpdateProhibited",
- 16 => "linked",
- 17 => "deleteCandidate", # grupistaatus
- 21 => "serverForceDelete" # grupistaatus
- }.freeze
-
-
- def name
- STATE_NAMES[state_id]
- end
-
- def desc
- map = {
- 1 => "Delete prohibited",
- 2 => "Registration renew prohibited",
- 3 => "Sponsoring registrar change prohibited",
- 4 => "Update prohibited",
- 7 => "Domain blocked",
- 8 => "Expires within 30 days",
- 9 => "Expired",
- 10 => "Domain is 30 days after expiration",
- 11 => "Validation of domain expire in 30 days",
- 12 => "Validation of domain expire in 15 days",
- 13 => "Domain not validated",
- 14 => "Domain has not associated nsset",
- 15 => "Domain is not generated into zone",
- 16 => "Has relation to other records in registry",
- 17 => "Object is going to be deleted",
- 18 => "Registrant change prohibited",
- 19 => "Domain will be deleted in 11 days",
- 20 => "Domain is out of zone after 30 days from expiration",
- 21 => "Domain is forced to delete",
- 5 => "Domain is administratively kept out of zone",
- 6 => "Domain is administratively kept in zone"
- }
-
- map[state_id]
- end
- end
-end
diff --git a/app/models/legacy/registrar.rb b/app/models/legacy/registrar.rb
deleted file mode 100644
index a0a0c251d7..0000000000
--- a/app/models/legacy/registrar.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-module Legacy
- class Registrar < Db
- self.table_name = :registrar
-
- has_many :invoices, foreign_key: :registrarid
- has_many :acl, foreign_key: :registrarid, class_name: "Legacy::RegistrarAcl"
-
- def account_balance
- invoices.sum(:credit)
- end
- end
-end
diff --git a/app/models/legacy/registrar_acl.rb b/app/models/legacy/registrar_acl.rb
deleted file mode 100644
index 711d8a2d65..0000000000
--- a/app/models/legacy/registrar_acl.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module Legacy
- class RegistrarAcl < Db
- self.table_name = :registraracl
- end
-end
diff --git a/app/models/legacy/zone_ns.rb b/app/models/legacy/zone_ns.rb
deleted file mode 100644
index f430e1b11b..0000000000
--- a/app/models/legacy/zone_ns.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module Legacy
- class ZoneNs < Db
- self.table_name = :zone_ns
- end
-end
diff --git a/app/views/admin/contacts/partials/_domains.haml b/app/views/admin/contacts/partials/_domains.haml
index 9d7e3edf59..3a60074d18 100644
--- a/app/views/admin/contacts/partials/_domains.haml
+++ b/app/views/admin/contacts/partials/_domains.haml
@@ -1,5 +1,5 @@
- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params)
-#contacts.panel.panel-default
+.panel.panel-default
.panel-heading
.pull-left
= t(:domains)
diff --git a/app/views/admin/contacts/partials/_statuses.haml b/app/views/admin/contacts/partials/_statuses.haml
deleted file mode 100644
index c39075754b..0000000000
--- a/app/views/admin/contacts/partials/_statuses.haml
+++ /dev/null
@@ -1,21 +0,0 @@
-- panel_class = contact.errors.messages[:statuses] ? 'panel-danger' : 'panel-default'
-#contact_statuses.panel{class: panel_class}
- .panel-heading.clearfix
- = t(:statuses)
- .table-responsive
- %table.table.table-hover.table-bordered.table-condensed
- %thead
- %tr
- %th{class: 'col-xs-6'}= t(:status)
- %th{class: 'col-xs-6'}= t(:notes)
- %tbody
- - contact.statuses.each do |status|
- %tr
- %td= status
- %td= contact.status_notes[status]
-
- - if contact.errors.messages[:statuses]
- %tfoot
- - @domain.errors.messages[:statuses].each do |s|
- %tr
- %td{colspan: 4}= s
diff --git a/app/views/admin/contacts/partials/_statuses.html.erb b/app/views/admin/contacts/partials/_statuses.html.erb
new file mode 100644
index 0000000000..2d1703c2c7
--- /dev/null
+++ b/app/views/admin/contacts/partials/_statuses.html.erb
@@ -0,0 +1,23 @@
+
+
+ <%= t '.header' %>
+
+
+
+
+
+ <%= t(:status) %> |
+ <%= t(:notes) %> |
+
+
+
+
+ <% contact.statuses.each do |status| %>
+
+ <%= status %> |
+ <%= contact.status_notes[status] %> |
+
+ <% end %>
+
+
+
diff --git a/app/views/admin/domains/_domain.html.erb b/app/views/admin/domains/_domain.html.erb
index 6431833e6c..8b69f90106 100644
--- a/app/views/admin/domains/_domain.html.erb
+++ b/app/views/admin/domains/_domain.html.erb
@@ -1,6 +1,6 @@
<%= link_to domain, admin_domain_path(domain) %> |
- <%= link_to domain.registrant, admin_registrant_path(domain.registrant) %> |
+ <%= link_to domain.registrant, admin_contact_path(domain.registrant) %> |
<%= l domain.expire_time %> |
<%= link_to domain.registrar, admin_registrar_path(domain.registrar) %> |
diff --git a/app/views/admin/domains/partials/_owner.haml b/app/views/admin/domains/partials/_owner.haml
index 611cd7dc61..f91cd21770 100644
--- a/app/views/admin/domains/partials/_owner.haml
+++ b/app/views/admin/domains/partials/_owner.haml
@@ -4,7 +4,7 @@
.panel-body
%dl.dl-horizontal
%dt= t(:name)
- %dd= link_to(@domain.registrant, [:admin, @domain.registrant])
+ %dd= link_to @domain.registrant, admin_contact_path(@domain.registrant)
%dt= t(:id)
%dd= @domain.registrant.code
diff --git a/app/views/admin/sessions/new.html.erb b/app/views/admin/sessions/new.html.erb
index c875c00ce4..e3e3471771 100644
--- a/app/views/admin/sessions/new.html.erb
+++ b/app/views/admin/sessions/new.html.erb
@@ -16,14 +16,8 @@
required: true,
class: 'form-control' %>
- <% if devise_mapping.rememberable? -%>
-
-
-
- <% end -%>
-
<%= f.submit t('.sign_in_btn'), class: 'btn btn-lg btn-primary btn-block' %>
<% end %>
-<%= render 'links' %>
\ No newline at end of file
+<%= render 'links' %>
diff --git a/app/views/epp/contacts/_disclosure_policy.xml.builder b/app/views/epp/contacts/_disclosure_policy.xml.builder
deleted file mode 100644
index f3ba881596..0000000000
--- a/app/views/epp/contacts/_disclosure_policy.xml.builder
+++ /dev/null
@@ -1,9 +0,0 @@
-if @disclosure_policy
- @disclosure_policy.each do |k,v|
- xml.tag!('contact:disclose', 'flag' => k) do
- v.each do |attr|
- xml.tag!("contact:#{attr}")
- end
- end
- end
-end
diff --git a/app/views/epp/contacts/_postal_info.xml.builder b/app/views/epp/contacts/_postal_info.xml.builder
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder
index 0686222035..38a96a7062 100644
--- a/app/views/epp/contacts/info.xml.builder
+++ b/app/views/epp/contacts/info.xml.builder
@@ -75,7 +75,6 @@ xml.epp_head do
xml.tag!('contact:pw', 'No access')
end
end
- # xml << render('/epp/contacts/disclosure_policy')
end
end
if can? :view_full_info, @contact, @password
diff --git a/app/views/registrant/domains/download_list.haml b/app/views/registrant/domains/download_list.haml
deleted file mode 100644
index f0af344cd4..0000000000
--- a/app/views/registrant/domains/download_list.haml
+++ /dev/null
@@ -1,28 +0,0 @@
-!!!
-%html
- %head
- %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
- %title Contacts
- %body
- .col-md-12
- .table-responsive
- %table.table.table-hover.table-bordered.table-condensed
- %thead
- %tr
- %th{class: 'col-xs-2'}
- =t(:name)
- %th{class: 'col-xs-2'}
- =t('.registrant')
- %th{class: 'col-xs-2'}
- =t(:valid_to)
- %th{class: 'col-xs-2'}
- =t(:registrar_name)
- %tbody
- - @domains.result.each do |x|
- %tr
- %td= x.name
- %td= x.registrant
- %td= l(x.valid_to, format: :short)
- %td= x.registrar
- .row
- .col-md-6
diff --git a/app/views/registrant/domains/index.html.erb b/app/views/registrant/domains/index.html.erb
index acb9afcff3..1254bfbc8c 100644
--- a/app/views/registrant/domains/index.html.erb
+++ b/app/views/registrant/domains/index.html.erb
@@ -18,6 +18,13 @@
<%= f.search_field :registrant_ident_eq, class: 'form-control', placeholder: t(:registrant_ident) %>
+
+
+
+ <%= label_tag t(:results_per_page) %>
+ <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
+
+
@@ -32,42 +39,26 @@
<%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_until) %>
-
-
- <%= label_tag t(:results_per_page) %>
- <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
-
-
+
-
-
diff --git a/app/views/registrant/domains/list_pdf.html.erb b/app/views/registrant/domains/list_pdf.html.erb
new file mode 100644
index 0000000000..4ce4f5ed0e
--- /dev/null
+++ b/app/views/registrant/domains/list_pdf.html.erb
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+ <%= Domain.human_attribute_name :name %> |
+ <%= Registrant.model_name.human %> |
+ <%= Domain.human_attribute_name :valid_to %> |
+ <%= Registrar.model_name.human %> |
+
+
+
+
+ <% @domains.each do |domain| %>
+
+ <%= domain.name %> |
+ <%= domain.registrant %> |
+ <%= l(domain.valid_to, format: :short) %> |
+ <%= domain.registrar %> |
+
+ <% end %>
+
+
+
+
+
+
+
diff --git a/app/views/registrar/contacts/_search_form.html.erb b/app/views/registrar/contacts/_search_form.html.erb
new file mode 100644
index 0000000000..e15ff18800
--- /dev/null
+++ b/app/views/registrar/contacts/_search_form.html.erb
@@ -0,0 +1,117 @@
+<%= search_form_for [:registrar, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f| %>
+
+
+
+ <%= f.label :name %>
+ <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %>
+
+
+
+
+
+ <%= f.label t(:id) %>
+ <%= f.search_field :code_eq, class: 'form-control', placeholder: t(:id) %>
+
+
+
+
+
+ <%= f.label t(:ident) %>
+ <%= f.search_field :ident_matches, class: 'form-control', placeholder: t(:ident) %>
+
+
+
+
+
+ <%= label_tag t(:ident_type) %>
+ <%= select_tag '[q][ident_type_eq]', options_for_select(ident_types, params[:q][:ident_type_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' } %>
+
+
+
+
+
+
+
+ <%= f.label t(:email) %>
+ <%= f.search_field :email_matches, class: 'form-control', placeholder: t(:email) %>
+
+
+
+
+
+ <%= label_tag t(:country) %>
+ <%= select_tag '[q][country_code_eq]', SortedCountry.all_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' } %>
+
+
+
+
+
+ <%= label_tag t(:contact_type) %>
+ <%= select_tag '[q][domain_contacts_type_in]', options_for_select([['admin', 'AdminDomainContact'], ['tech', 'TechDomainContact'], ['registrant', 'registrant']], params[:q][:domain_contacts_type_in]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' } %>
+
+
+
+
+
+
+
+ <%= f.label t(:registrar_name) %>
+ <%= f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control selectize', placeholder: t(:choose) %>
+
+
+
+
+
+ <%= f.label t(:created_at_from) %>
+ <%= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_at_from) %>
+
+
+
+
+
+ <%= f.label t(:created_at_until) %>
+ <%= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_at_until) %>
+
+
+
+
+
+ <%= f.label t(:updated_at) %>
+ <%= f.search_field :updated_at_gteq, value: params[:q][:updated_at_gteq], class: 'form-control js-datepicker', placeholder: t(:updated_at) %>
+
+
+
+
+
+
+
+ <%= label_tag t(:status) %>
+ <%= select_tag :statuses_contains, options_for_select(Contact::STATUSES, params[:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' } %>
+
+
+
+
+
+ <%= label_tag t(:results_per_page) %>
+ <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %>
+
+
+
+
+
+
+
+
+
+ <%= button_tag t('.download_pdf_btn'),
+ formaction: registrar_contacts_path(format: :pdf),
+ name: nil,
+ class: 'btn btn-default' %>
+ <%= button_tag t('.download_csv_btn'),
+ formaction: registrar_contacts_path(format: :csv),
+ name: nil,
+ class: 'btn btn-default' %>
+ <%= link_to(t('.reset_btn'), registrar_contacts_path, class: 'btn btn-default') %>
+
+
+<% end %>
diff --git a/app/views/registrar/contacts/download_list.haml b/app/views/registrar/contacts/download_list.haml
deleted file mode 100644
index 51423a3f22..0000000000
--- a/app/views/registrar/contacts/download_list.haml
+++ /dev/null
@@ -1,30 +0,0 @@
-!!!
-%html
- %head
- %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
- %title Contacts
- %body
- .row
- .col-md-12
- .table-responsive
- %table.table.table-hover.table-bordered.table-condensed
- %thead
- %tr
- %th{class: 'col-xs-2'}
- =t(:name)
- %th{class: 'col-xs-2'}
- =t(:id)
- %th{class: 'col-xs-2'}
- =t(:ident)
- %th{class: 'col-xs-2'}
- =t(:created_at)
- %th{class: 'col-xs-2'}
- =t(:registrar_name)
- %tbody
- - @contacts.each do |contact|
- %tr
- %td= contact
- %td= contact.code
- %td= ident_for(contact)
- %td= l(contact.created_at, format: :short)
- %td= contact.registrar
diff --git a/app/views/registrar/contacts/index.haml b/app/views/registrar/contacts/index.haml
deleted file mode 100644
index 518e6eccfc..0000000000
--- a/app/views/registrar/contacts/index.haml
+++ /dev/null
@@ -1,120 +0,0 @@
-- content_for :actions do
- = link_to(t(:new), new_registrar_contact_path, class: 'btn btn-primary')
-= render 'shared/title', name: t(:contacts)
-
-.row
- .col-md-12
- = search_form_for [:registrar, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f|
- .row
- .col-md-3
- .form-group
- = f.label :name
- = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name)
- .col-md-3
- .form-group
- = f.label t(:id)
- = f.search_field :code_eq, class: 'form-control', placeholder: t(:id)
- .col-md-3
- .form-group
- = f.label t(:ident)
- = f.search_field :ident_matches, class: 'form-control', placeholder: t(:ident)
- .col-md-3
- .form-group
- = label_tag t(:ident_type)
- = select_tag '[q][ident_type_eq]', options_for_select(ident_types, params[:q][:ident_type_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
- .row
- .col-md-3
- .form-group
- = f.label t(:email)
- = f.search_field :email_matches, class: 'form-control', placeholder: t(:email)
- .col-md-3
- .form-group
- = label_tag t(:country)
- = select_tag '[q][country_code_eq]', SortedCountry.all_options(params[:q][:country_code_eq]), { include_blank: true, placeholder: t(:choose), class: 'form-control selectize' }
- .col-md-6
- .form-group
- = label_tag t(:contact_type)
- = select_tag '[q][domain_contacts_type_in]', options_for_select([['admin', 'AdminDomainContact'], ['tech', 'TechDomainContact'], ['registrant', 'registrant']], params[:q][:domain_contacts_type_in]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
- .row
- .col-md-3
- .form-group
- = f.label t(:registrar_name)
- = f.select :registrar_id_eq, Registrar.all.map { |x| [x, x.id] }, { include_blank: true }, class: 'form-control selectize', placeholder: t(:choose)
- .col-md-3
- .form-group
- = f.label t(:created_at_from)
- = f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_at_from)
- .col-md-3
- .form-group
- = f.label t(:created_at_until)
- = f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_at_until)
- .col-md-3
- .form-group
- = f.label t(:updated_at)
- = f.search_field :updated_at_gteq, value: params[:q][:updated_at_gteq], class: 'form-control js-datepicker', placeholder: t(:updated_at)
- .row
- .col-md-6
- .form-group
- = label_tag t(:status)
- = select_tag :statuses_contains, options_for_select(Contact::STATUSES, params[:statuses_contains]), { multiple: true, placeholder: t(:choose), class: 'form-control js-combobox' }
- .col-md-3
- .form-group
- = label_tag t(:results_per_page)
- = text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page)
- .col-md-3{style: 'padding-top: 25px;'}
- %button.btn.btn-primary
-
- %span.glyphicon.glyphicon-search
-
- = link_to(t('.reset_btn'), registrar_contacts_path, class: 'btn btn-default')
- .row
- .col-md-3
- .btn-group{:role => "group"}
- %button.btn.btn-default.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button"}
- Download
- %span.caret
- %ul.dropdown-menu
- %li= link_to 'PDF', download_list_registrar_contacts_path(q: params[:q], format: "pdf")
- %li= link_to 'CSV', download_list_registrar_contacts_path(q: params[:q], format: "csv")
- .col-md-3
- .col-md-3
- .col-md-3
-
-%hr
-.row
- .col-md-12
- .table-responsive
- %table.table.table-hover.table-bordered.table-condensed.contacts
- %thead
- %tr
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'name', t(:name))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'code', t(:id))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'ident', t(:ident))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'email', t(:created_at))
- %th{class: 'col-xs-2'}
- = sort_link(@q, 'registrar_name', t(:registrar_name))
- %th{class: 'col-xs-2'}= t(:actions)
- %tbody
- - @contacts.each do |contact|
- %tr
- %td= link_to(contact.name, registrar_contact_path(id: contact.code))
- %td= contact.code
- %td= ident_for(contact)
- %td= l(contact.created_at, format: :short)
- %td
- - if contact.registrar
- = contact.registrar
- %td
- = link_to(t(:edit), edit_registrar_contact_path(contact.code), class: 'btn btn-primary btn-xs')
- = link_to(t(:delete), delete_registrar_contact_path(contact.code), class: 'btn btn-default btn-xs')
-
-.row
- .col-md-6
- = paginate @contacts
- .col-md-6.text-right
- .pagination
- = t(:result_count, count: @contacts.total_count)
diff --git a/app/views/registrar/contacts/index.html.erb b/app/views/registrar/contacts/index.html.erb
new file mode 100644
index 0000000000..4a7e8759a0
--- /dev/null
+++ b/app/views/registrar/contacts/index.html.erb
@@ -0,0 +1,77 @@
+<% content_for :actions do %>
+ <%= link_to(t(:new), new_registrar_contact_path, class: 'btn btn-primary') %>
+<% end %>
+<%= render 'shared/title', name: t(:contacts) %>
+
+
+ <%= render 'search_form' %>
+
+
+
+
+
+
+ <%= paginate @contacts %>
+
+
+
+
+
diff --git a/app/views/registrar/contacts/list_pdf.html.erb b/app/views/registrar/contacts/list_pdf.html.erb
new file mode 100644
index 0000000000..b9bbb1c0e8
--- /dev/null
+++ b/app/views/registrar/contacts/list_pdf.html.erb
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+ <%= Contact.human_attribute_name :name %> |
+ <%= Contact.human_attribute_name :code %> |
+ <%= Contact.human_attribute_name :ident %> |
+ <%= Contact.human_attribute_name :created_at %> |
+ <%= Registrar.model_name.human %> |
+
+
+
+
+ <% @contacts.each do |contact| %>
+
+ <%= contact %> |
+ <%= contact.code %> |
+ <%= ident_for(contact) %> |
+ <%= l(contact.created_at, format: :short) %> |
+ <%= contact.registrar %> |
+
+ <% end %>
+
+
+
+
+
+
+
diff --git a/app/views/registrar/contacts/partials/_domains.haml b/app/views/registrar/contacts/partials/_domains.haml
index d2943e8ef1..f409a6f24c 100644
--- a/app/views/registrar/contacts/partials/_domains.haml
+++ b/app/views/registrar/contacts/partials/_domains.haml
@@ -1,5 +1,5 @@
- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params)
-#contacts.panel.panel-default
+.panel.panel-default
.panel-heading
.pull-left
= t(:domains)
diff --git a/app/views/registrar/domains/_search_form.html.erb b/app/views/registrar/domains/_search_form.html.erb
index b494e0d8d5..743f8de60b 100644
--- a/app/views/registrar/domains/_search_form.html.erb
+++ b/app/views/registrar/domains/_search_form.html.erb
@@ -74,14 +74,14 @@
-
+
- <%= button_tag t('.download_btn'), class: 'btn btn-primary export-domains-csv-btn',
- formaction: registrar_domains_path(format: 'csv') %>
+ <%= button_tag t('.download_btn'), formaction: registrar_domains_path(format: 'csv'),
+ class: 'btn btn-default' %>
<%= link_to t('.reset_btn'), registrar_domains_path, class: 'btn btn-default' %>
diff --git a/bin/setup b/bin/setup
old mode 100644
new mode 100755
index acdb2c1389..ea95b5dc2b
--- a/bin/setup
+++ b/bin/setup
@@ -1,29 +1,32 @@
#!/usr/bin/env ruby
require 'pathname'
+require 'fileutils'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
Dir.chdir APP_ROOT do
- # This script is a starting point to setup your application.
- # Add necessary setup steps to this file:
- puts "== Installing dependencies =="
- system "gem install bundler --conservative"
- system "bundle check || bundle install"
+ puts '== Installing dependencies with bundler =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
- # puts "\n== Copying sample files =="
- # unless File.exist?("config/database.yml")
- # system "cp config/database.yml.sample config/database.yml"
- # end
+ puts "\n== Copying sample development database config files =="
+ unless File.exist?('config/database.yml')
+ system! 'cp config/database-example-development.yml config/database.yml'
+ end
puts "\n== Preparing database =="
- system "bin/rake db:setup"
+ system! 'bin/rake db:setup'
puts "\n== Removing old logs and tempfiles =="
- system "rm -f log/*"
- system "rm -rf tmp/cache"
+ system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
- system "touch tmp/restart.txt"
+ system! 'bin/rails restart'
end
diff --git a/bin/setup_with_build_deps b/bin/setup_with_build_deps
new file mode 100755
index 0000000000..bbd3707db1
--- /dev/null
+++ b/bin/setup_with_build_deps
@@ -0,0 +1,56 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+def effective_user_id
+ uid = `id -u`
+ uid.strip!
+end
+
+Dir.chdir APP_ROOT do
+ puts '== Installing application build deps =='
+ sudo_prefix = ''
+ sudo_prefix = "sudo" unless effective_user_id == '0'
+ system! "#{sudo_prefix} apt-get update && #{sudo_prefix} apt-get -y --no-install-recommends install libxml2 libxml2-dev postgresql-client postgresql-client-common libpq-dev"
+
+ puts "== Installing rbenv ruby manager to #{ENV['HOME']} =="
+ unless Dir.exist?("#{ENV['HOME']}/.rbenv/")
+ system! 'git clone https://github.com/sstephenson/rbenv.git $HOME/.rbenv'
+ system! 'echo export PATH="$HOME/.rbenv/bin:$PATH" >> ~/.bashrc'
+ system! "echo 'eval $(rbenv init -)' >> ~/.bashrc"
+ end
+
+ unless Dir.exist?("#{ENV['HOME']}/.rbenv/plugins/ruby-build/")
+ system! 'git clone https://github.com/sstephenson/ruby-build.git $HOME/.rbenv/plugins/ruby-build'
+ system! 'echo export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH" >> ~/.bashrc'
+ end
+ unless Dir.exist?("#{ENV['HOME']}/.rbenv/plugins/rbenv-default-gems/")
+ system! 'git clone https://github.com/rbenv/rbenv-default-gems.git $HOME/.rbenv/plugins/rbenv-default-gems'
+ unless File.exist?("#{ENV['HOME']}/.rbenv/default-gems")
+ system! 'echo "bundler" > ~/.rbenv/default-gems'
+ end
+ end
+
+ # Include RBENV in path
+ ENV['PATH'] = ENV['HOME'] + "/.rbenv/bin:" + ENV['HOME'] + "/.rbenv/plugins/ruby-build/bin:" + ENV['PATH']
+ NEEDED_RUBY_VERSION = `cat .ruby-version`.freeze
+
+ if `!bundle check` == false
+ system! "#{SUDO_PREFIX} apt-get -y --no-install-recommends install libreadline-dev"
+ puts 'Installing Ruby: ' + NEEDED_RUBY_VERSION
+ system!('rbenv install ' + NEEDED_RUBY_VERSION)
+ system!('rbenv rehash')
+ else
+ puts 'Ruby ' + NEEDED_RUBY_VERSION + 'already installed'
+ end
+ puts 'Now running setup'
+ exec('./bin/setup')
+end
diff --git a/config/environments/development.rb.sample b/config/environments/development.rb.sample
index 59efe01d93..f5ed70e06c 100644
--- a/config/environments/development.rb.sample
+++ b/config/environments/development.rb.sample
@@ -32,16 +32,6 @@ Rails.application.configure do
config.assets.raise_runtime_errors = true
config.action_view.raise_on_missing_translations = true
-
- # for finding database optimization
- config.after_initialize do
- Bullet.enable = true
- Bullet.bullet_logger = true
- Bullet.console = true
- Bullet.rails_logger = true
- Bullet.add_footer = true
- Bullet.unused_eager_loading_enable = false
- end
end
# In this mode, any jobs you queue will be run in the same thread, synchronously
diff --git a/config/initializers/pdfkit.rb b/config/initializers/pdfkit.rb
deleted file mode 100644
index d7bbc64b83..0000000000
--- a/config/initializers/pdfkit.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-PDFKit.configure do |config|
- installed = %x(which wkhtmltopdf).chomp
- if installed == "" then
- installed = "#{Rails.root}/vendor/bin/wkhtmltopdf"
- end
- config.wkhtmltopdf = installed
- config.default_options = {
- page_size: 'A4',
- quiet: true
- # :print_media_type => true
- }
-end
diff --git a/config/locales/admin/contacts.en.yml b/config/locales/admin/contacts.en.yml
index 0ae48821fd..44759886a9 100644
--- a/config/locales/admin/contacts.en.yml
+++ b/config/locales/admin/contacts.en.yml
@@ -15,3 +15,6 @@ en:
domains:
roles: Roles
+
+ statuses:
+ header: Statuses
diff --git a/config/locales/registrant/domains.en.yml b/config/locales/registrant/domains.en.yml
index 2dbdce79a7..1e02d00e19 100644
--- a/config/locales/registrant/domains.en.yml
+++ b/config/locales/registrant/domains.en.yml
@@ -4,11 +4,10 @@ en:
index:
header: Domains
registrant: Registrant
+ download_pdf_btn: Download PDF
+ download_csv_btn: Download CSV
reset_btn: Reset
- download_list:
- registrant: Registrant
-
partials:
registrant:
header: Registrant
diff --git a/config/locales/registrar/contacts.en.yml b/config/locales/registrar/contacts.en.yml
index 84afd481d0..590e419d28 100644
--- a/config/locales/registrar/contacts.en.yml
+++ b/config/locales/registrar/contacts.en.yml
@@ -1,7 +1,9 @@
en:
registrar:
contacts:
- index:
+ search_form:
+ download_pdf_btn: Download PDF
+ download_csv_btn: Download CSV
reset_btn: Reset
partials:
diff --git a/config/locales/registrar/domains.en.yml b/config/locales/registrar/domains.en.yml
index 31380074f0..c98002b8f8 100644
--- a/config/locales/registrar/domains.en.yml
+++ b/config/locales/registrar/domains.en.yml
@@ -17,7 +17,7 @@ en:
transfer_btn: Transfer
search_form:
- download_btn: Download as CSV
+ download_btn: Download CSV
reset_btn: Reset
domain:
diff --git a/config/routes.rb b/config/routes.rb
index 4b65087b59..0486284d5a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,14 +1,39 @@
require_dependency 'epp_constraint'
Rails.application.routes.draw do
- namespace(:epp, defaults: { format: :xml }) do
- match 'session/:action', controller: 'sessions', via: :all, constraints: EppConstraint.new(:session)
+ # https://github.com/internetee/epp_proxy#translation-of-epp-calls
+ namespace :epp do
+ constraints(EppConstraint.new(:session)) do
+ get 'session/hello', to: 'sessions#hello', as: 'hello'
+ post 'session/login', to: 'sessions#login', as: 'login'
+ post 'session/logout', to: 'sessions#logout', as: 'logout'
+ end
+
+ constraints(EppConstraint.new(:contact)) do
+ controller('contacts') do
+ post 'command/create', action: 'create', as: :create
+ post 'command/update', action: 'update', as: :update
+ post 'command/info', action: 'info', as: :info
+ post 'command/check', action: 'check', as: :check
+ post 'command/transfer', action: 'transfer', as: :transfer
+ post 'command/renew', action: 'renew', as: :renew
+ post 'command/delete', action: 'delete', as: :delete
+ end
+ end
- post 'command/:action', controller: 'domains', constraints: EppConstraint.new(:domain)
- post 'command/:action', controller: 'contacts', constraints: EppConstraint.new(:contact)
- post 'command/poll', to: 'polls#poll', constraints: EppConstraint.new(:poll)
- post 'command/keyrelay', to: 'keyrelays#keyrelay', constraints: EppConstraint.new(:keyrelay)
+ constraints(EppConstraint.new(:domain)) do
+ controller('domains') do
+ post 'command/create', action: 'create', as: nil
+ post 'command/update', action: 'update', as: nil
+ post 'command/info', action: 'info', as: nil
+ post 'command/check', action: 'check', as: nil
+ post 'command/transfer', action: 'transfer', as: nil
+ post 'command/renew', action: 'renew', as: nil
+ post 'command/delete', action: 'delete', as: nil
+ end
+ end
+ post 'command/poll', to: 'polls#poll', as: 'poll', constraints: EppConstraint.new(:poll)
get 'error/:command', to: 'errors#error'
end
@@ -87,7 +112,6 @@
collection do
get 'check'
- get 'download_list'
end
end
@@ -151,11 +175,6 @@
resources :registrars, only: :show
resources :domains, only: %i[index show] do
resources :contacts, only: %i[show edit update]
-
- collection do
- get :download_list
- end
-
member do
get 'confirmation'
end
@@ -250,8 +269,6 @@
resources :white_ips
end
- resources :registrants, controller: 'contacts'
-
resources :contacts do
collection do
get 'search'
diff --git a/db/migrate/20191004095229_change_reserved_domains_name_to_not_null.rb b/db/migrate/20191004095229_change_reserved_domains_name_to_not_null.rb
new file mode 100644
index 0000000000..74ca0235b4
--- /dev/null
+++ b/db/migrate/20191004095229_change_reserved_domains_name_to_not_null.rb
@@ -0,0 +1,5 @@
+class ChangeReservedDomainsNameToNotNull < ActiveRecord::Migration
+ def change
+ change_column_null :reserved_domains, :name, false
+ end
+end
diff --git a/db/migrate/20191004103144_add_reserved_domains_name_uniq_constraint.rb b/db/migrate/20191004103144_add_reserved_domains_name_uniq_constraint.rb
new file mode 100644
index 0000000000..81202d28a6
--- /dev/null
+++ b/db/migrate/20191004103144_add_reserved_domains_name_uniq_constraint.rb
@@ -0,0 +1,13 @@
+class AddReservedDomainsNameUniqConstraint < ActiveRecord::Migration
+ def up
+ execute <<-SQL
+ ALTER TABLE reserved_domains ADD CONSTRAINT uniq_reserved_domains_name UNIQUE (name);
+ SQL
+ end
+
+ def down
+ execute <<-SQL
+ ALTER TABLE reserved_domains DROP CONSTRAINT uniq_reserved_domains_name;
+ SQL
+ end
+end
diff --git a/db/migrate/20191004105643_change_blocked_domains_name_to_not_null.rb b/db/migrate/20191004105643_change_blocked_domains_name_to_not_null.rb
new file mode 100644
index 0000000000..ef5fbf5cf6
--- /dev/null
+++ b/db/migrate/20191004105643_change_blocked_domains_name_to_not_null.rb
@@ -0,0 +1,5 @@
+class ChangeBlockedDomainsNameToNotNull < ActiveRecord::Migration
+ def change
+ change_column_null :blocked_domains, :name, false
+ end
+end
diff --git a/db/migrate/20191004105732_add_blocked_domains_name_uniq_constraint.rb b/db/migrate/20191004105732_add_blocked_domains_name_uniq_constraint.rb
new file mode 100644
index 0000000000..7542831f97
--- /dev/null
+++ b/db/migrate/20191004105732_add_blocked_domains_name_uniq_constraint.rb
@@ -0,0 +1,13 @@
+class AddBlockedDomainsNameUniqConstraint < ActiveRecord::Migration
+ def up
+ execute <<-SQL
+ ALTER TABLE blocked_domains ADD CONSTRAINT uniq_blocked_domains_name UNIQUE (name);
+ SQL
+ end
+
+ def down
+ execute <<-SQL
+ ALTER TABLE blocked_domains DROP CONSTRAINT uniq_blocked_domains_name;
+ SQL
+ end
+end
diff --git a/db/migrate/20191004110234_remove_blocked_domains_name_index.rb b/db/migrate/20191004110234_remove_blocked_domains_name_index.rb
new file mode 100644
index 0000000000..04dd0c1fb5
--- /dev/null
+++ b/db/migrate/20191004110234_remove_blocked_domains_name_index.rb
@@ -0,0 +1,5 @@
+class RemoveBlockedDomainsNameIndex < ActiveRecord::Migration
+ def change
+ remove_index :blocked_domains, name: 'index_blocked_domains_on_name'
+ end
+end
diff --git a/db/migrate/20191004154844_add_constraints.rb b/db/migrate/20191004154844_add_constraints.rb
new file mode 100644
index 0000000000..4da2a50e30
--- /dev/null
+++ b/db/migrate/20191004154844_add_constraints.rb
@@ -0,0 +1,19 @@
+class AddConstraints < ActiveRecord::Migration
+ def change
+ change_column_null :registrant_verifications, :domain_name, false
+ change_column_null :registrant_verifications, :verification_token, false
+ change_column_null :registrant_verifications, :action, false
+ change_column_null :registrant_verifications, :domain_id, false
+ change_column_null :registrant_verifications, :action_type, false
+ add_foreign_key :registrant_verifications, :domains
+
+ change_column_null :zones, :origin, false
+ change_column_null :zones, :ttl, false
+ change_column_null :zones, :refresh, false
+ change_column_null :zones, :retry, false
+ change_column_null :zones, :expire, false
+ change_column_null :zones, :minimum_ttl, false
+ change_column_null :zones, :email, false
+ change_column_null :zones, :master_nameserver, false
+ end
+end
diff --git a/db/migrate/20191005162437_add_constraints_part_ii.rb b/db/migrate/20191005162437_add_constraints_part_ii.rb
new file mode 100644
index 0000000000..eb7d289e84
--- /dev/null
+++ b/db/migrate/20191005162437_add_constraints_part_ii.rb
@@ -0,0 +1,6 @@
+class AddConstraintsPartIi < ActiveRecord::Migration
+ def change
+ change_column_null :white_ips, :registrar_id, false
+ add_foreign_key :white_ips, :registrars
+ end
+end
diff --git a/db/migrate/20191007123000_add_constraints_part_iii.rb b/db/migrate/20191007123000_add_constraints_part_iii.rb
new file mode 100644
index 0000000000..dae4bb83b2
--- /dev/null
+++ b/db/migrate/20191007123000_add_constraints_part_iii.rb
@@ -0,0 +1,7 @@
+class AddConstraintsPartIii < ActiveRecord::Migration
+ def change
+ change_column_null :domains, :name, false
+ change_column_null :domains, :name_puny, false
+ change_column_null :domains, :name_dirty, false
+ end
+end
diff --git a/db/migrate/20191024153351_add_invoice_items_quantity_constraint.rb b/db/migrate/20191024153351_add_invoice_items_quantity_constraint.rb
new file mode 100644
index 0000000000..9f99fa607c
--- /dev/null
+++ b/db/migrate/20191024153351_add_invoice_items_quantity_constraint.rb
@@ -0,0 +1,14 @@
+class AddInvoiceItemsQuantityConstraint < ActiveRecord::Migration
+ def up
+ execute <<~SQL
+ ALTER TABLE invoice_items ADD CONSTRAINT invoice_items_quantity_is_positive
+ CHECK (quantity > 0);
+ SQL
+ end
+
+ def down
+ execute <<~SQL
+ ALTER TABLE invoice_items DROP CONSTRAINT invoice_items_quantity_is_positive;
+ SQL
+ end
+end
diff --git a/db/migrate/20191024160038_add_invoices_due_date_constraint.rb b/db/migrate/20191024160038_add_invoices_due_date_constraint.rb
new file mode 100644
index 0000000000..313f5d2762
--- /dev/null
+++ b/db/migrate/20191024160038_add_invoices_due_date_constraint.rb
@@ -0,0 +1,14 @@
+class AddInvoicesDueDateConstraint < ActiveRecord::Migration
+ def up
+ execute <<~SQL
+ ALTER TABLE invoices ADD CONSTRAINT invoices_due_date_is_not_before_issue_date
+ CHECK (due_date >= issue_date);
+ SQL
+ end
+
+ def down
+ execute <<~SQL
+ ALTER TABLE invoices DROP CONSTRAINT invoices_due_date_is_not_before_issue_date;
+ SQL
+ end
+end
diff --git a/db/seeds.rb b/db/seeds.rb
index 5dde233422..f8a9f42678 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,2 +1,59 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+ActiveRecord::Base.transaction do
+ AdminUser.where(username: 'admin').first_or_create!(
+ username: 'admin',
+ email: 'admin@domain.tld',
+ password: 'adminadmin',
+ password_confirmation: 'adminadmin',
+ identity_code: '38001085718',
+ country_code: 'EE',
+ roles: ['admin']
+ )
+ # Required for creating registrar
+ Setting.where(var: 'registry_vat_prc').first_or_create(
+ value: '0.2'
+ )
+ # First registrar
+ Registrar.where(name: 'Registrar First').first_or_create!(
+ name: 'Registrar First',
+ reg_no: '90010019',
+ accounting_customer_code: '1234',
+ language: 'EE',
+ reference_no: '11',
+ # vat_rate: '0.2',
+ vat_no: 'EE101286464',
+ address_country_code: 'EE',
+ address_state: 'Harjumaa',
+ address_city: 'Tallinn',
+ address_street: 'Tänav 1',
+ address_zip: '1234546',
+ email: 'registrar@first.tld',
+ code: 'REG1'
+ )
+
+# registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
+
+# ApiUser.create!(
+# username: 'api_first',
+# password: 'api_first',
+# identity_code: '38001085718',
+# active: true,
+# registrar: registrar,
+# roles: ['epp']
+# )
+
+
+
+# ZonefileSetting.create!(
+# origin: 'tld',
+# ttl: 43200,
+# refresh: 3600,
+# retry: 900,
+# expire: 1209600,
+# minimum_ttl: 3600,
+# email: 'admin.domain.tld',
+# master_nameserver: 'ns.tld'
+# )
+end
diff --git a/db/structure.sql b/db/structure.sql
index 3b5a6a55f7..c487fbf871 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -525,7 +525,7 @@ CREATE TABLE public.blocked_domains (
updated_at timestamp without time zone,
creator_str character varying,
updator_str character varying,
- name character varying
+ name character varying NOT NULL
);
@@ -801,7 +801,7 @@ ALTER SEQUENCE public.domain_transfers_id_seq OWNED BY public.domain_transfers.i
CREATE TABLE public.domains (
id integer NOT NULL,
- name character varying,
+ name character varying NOT NULL,
registrar_id integer NOT NULL,
registered_at timestamp without time zone,
valid_to timestamp without time zone NOT NULL,
@@ -809,8 +809,8 @@ CREATE TABLE public.domains (
transfer_code character varying NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
- name_dirty character varying,
- name_puny character varying,
+ name_dirty character varying NOT NULL,
+ name_puny character varying NOT NULL,
period integer,
period_unit character varying(1),
creator_str character varying,
@@ -899,7 +899,8 @@ CREATE TABLE public.invoice_items (
created_at timestamp without time zone,
updated_at timestamp without time zone,
creator_str character varying,
- updator_str character varying
+ updator_str character varying,
+ CONSTRAINT invoice_items_quantity_is_positive CHECK ((quantity > 0))
);
@@ -968,7 +969,8 @@ CREATE TABLE public.invoices (
total numeric(10,2) NOT NULL,
in_directo boolean DEFAULT false,
buyer_vat_no character varying,
- issue_date date NOT NULL
+ issue_date date NOT NULL,
+ CONSTRAINT invoices_due_date_is_not_before_issue_date CHECK ((due_date >= issue_date))
);
@@ -2030,13 +2032,13 @@ ALTER SEQUENCE public.que_jobs_job_id_seq OWNED BY public.que_jobs.job_id;
CREATE TABLE public.registrant_verifications (
id integer NOT NULL,
- domain_name character varying,
- verification_token character varying,
+ domain_name character varying NOT NULL,
+ verification_token character varying NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
- action character varying,
- domain_id integer,
- action_type character varying
+ action character varying NOT NULL,
+ domain_id integer NOT NULL,
+ action_type character varying NOT NULL
);
@@ -2123,7 +2125,7 @@ CREATE TABLE public.reserved_domains (
creator_str character varying,
updator_str character varying,
legacy_id integer,
- name character varying,
+ name character varying NOT NULL,
password character varying NOT NULL
);
@@ -2285,7 +2287,7 @@ ALTER SEQUENCE public.versions_id_seq OWNED BY public.versions.id;
CREATE TABLE public.white_ips (
id integer NOT NULL,
- registrar_id integer,
+ registrar_id integer NOT NULL,
ipv4 character varying,
ipv6 character varying,
interfaces character varying[],
@@ -2356,14 +2358,14 @@ ALTER SEQUENCE public.whois_records_id_seq OWNED BY public.whois_records.id;
CREATE TABLE public.zones (
id integer NOT NULL,
- origin character varying,
- ttl integer,
- refresh integer,
- retry integer,
- expire integer,
- minimum_ttl integer,
- email character varying,
- master_nameserver character varying,
+ origin character varying NOT NULL,
+ ttl integer NOT NULL,
+ refresh integer NOT NULL,
+ retry integer NOT NULL,
+ expire integer NOT NULL,
+ minimum_ttl integer NOT NULL,
+ email character varying NOT NULL,
+ master_nameserver character varying NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
creator_str character varying,
@@ -3148,6 +3150,14 @@ ALTER TABLE ONLY public.settings
ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
+--
+-- Name: uniq_blocked_domains_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY public.blocked_domains
+ ADD CONSTRAINT uniq_blocked_domains_name UNIQUE (name);
+
+
--
-- Name: uniq_contact_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@@ -3164,6 +3174,14 @@ ALTER TABLE ONLY public.domains
ADD CONSTRAINT uniq_domain_uuid UNIQUE (uuid);
+--
+-- Name: uniq_reserved_domains_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
+--
+
+ALTER TABLE ONLY public.reserved_domains
+ ADD CONSTRAINT uniq_reserved_domains_name UNIQUE (name);
+
+
--
-- Name: uniq_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@@ -3304,13 +3322,6 @@ CREATE INDEX index_account_activities_on_invoice_id ON public.account_activities
CREATE INDEX index_accounts_on_registrar_id ON public.accounts USING btree (registrar_id);
---
--- Name: index_blocked_domains_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
---
-
-CREATE INDEX index_blocked_domains_on_name ON public.blocked_domains USING btree (name);
-
-
--
-- Name: index_certificates_on_api_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@@ -3919,6 +3930,14 @@ ALTER TABLE ONLY public.invoices
ADD CONSTRAINT fk_rails_242b91538b FOREIGN KEY (buyer_id) REFERENCES public.registrars(id);
+--
+-- Name: fk_rails_36cff3de9c; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.white_ips
+ ADD CONSTRAINT fk_rails_36cff3de9c FOREIGN KEY (registrar_id) REFERENCES public.registrars(id);
+
+
--
-- Name: fk_rails_59c422f73d; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -4023,6 +4042,14 @@ ALTER TABLE ONLY public.account_activities
ADD CONSTRAINT fk_rails_d2cc3c2fa9 FOREIGN KEY (price_id) REFERENCES public.prices(id);
+--
+-- Name: fk_rails_f41617a0e9; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.registrant_verifications
+ ADD CONSTRAINT fk_rails_f41617a0e9 FOREIGN KEY (domain_id) REFERENCES public.domains(id);
+
+
--
-- Name: invoice_items_invoice_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@@ -4835,5 +4862,25 @@ INSERT INTO schema_migrations (version) VALUES ('20190811202711');
INSERT INTO schema_migrations (version) VALUES ('20190811205406');
+INSERT INTO schema_migrations (version) VALUES ('20191004095229');
+
+INSERT INTO schema_migrations (version) VALUES ('20191004103144');
+
+INSERT INTO schema_migrations (version) VALUES ('20191004105643');
+
+INSERT INTO schema_migrations (version) VALUES ('20191004105732');
+
+INSERT INTO schema_migrations (version) VALUES ('20191004110234');
+
+INSERT INTO schema_migrations (version) VALUES ('20191004154844');
+
+INSERT INTO schema_migrations (version) VALUES ('20191005162437');
+
+INSERT INTO schema_migrations (version) VALUES ('20191007123000');
+
INSERT INTO schema_migrations (version) VALUES ('20191008024334');
+INSERT INTO schema_migrations (version) VALUES ('20191024153351');
+
+INSERT INTO schema_migrations (version) VALUES ('20191024160038');
+
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
deleted file mode 100644
index ebd40a65e5..0000000000
--- a/lib/tasks/import.rake
+++ /dev/null
@@ -1,783 +0,0 @@
-namespace :import do
- # README
- #
- # 1) ESTABLISH CONNECTION TO FRED DATABASE
- # ----------------------------------------
- #
- # Add 'fred' database connection settings to config/database.yml
- # Example config:
- #
- # fred:
- # host: localhost
- # adapter: postgresql
- # encoding: unicode
- # pool: 5
- # username: fred
- # password: fred
- #
- # Verify you have correctly connected to fred database:
- # Open Rails console:
- #
- # cd your_registry_deploy_path/current/
- # RAILS_ENV=production bundle exec rails c
- # in console: Legacy::Contact.last
- # in console: exit
- #
- # In console you should get Last Legacy::Contact object.
- # If you get any errors, scroll up and read first lines
- # to figure out what went wrong to connect to fred database.
- #
- #
- # 2) START IMPORT
- # ---------------
- #
- # Import scrip does not write anything to fred database.
- # Script is implemented this way, you can run it multiple times
- # in case you need it. However already imported object are
- # not reimported, thus if some object has been updated meanwhile
- # in fred database, those updates will be missed and thous should
- # be carried over manually. All new object in fred will be
- # imported in multiple import script runs.
- #
- # Start all import:
- #
- # cd your_registry_deploy_path/current/
- # RAILS_ENV=production bundle exec rails import:all
- #
- # If you wish to import one by one, please follow individual import order
- # from task 'Import all' tasks in this script.
-
- desc 'Import all'
- task all: :environment do
- Rake::Task['import:registrars'].invoke
- Rake::Task['import:users'].invoke
- Rake::Task['import:contacts'].invoke
- Rake::Task['import:reserved'].invoke
- Rake::Task['import:domains'].invoke
- Rake::Task['import:zones'].invoke
- end
-
- desc 'Import registrars'
- task registrars: :environment do
- start = Time.zone.now.to_f
- puts '-----> Importing registrars...'
-
- registrars = []
- existing_ids = Registrar.pluck(:legacy_id)
- user = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
- count = 0
-
- Legacy::Registrar.all.each do |x|
- next if existing_ids.include?(x.id)
- count += 1
-
- registrars << Registrar.new({
- name: x.organization.try(:strip).presence || x.name.try(:strip).presence || x.handle.try(:strip).presence,
- reg_no: x.ico.try(:strip),
- vat_no: x.dic.try(:strip),
- phone: x.telephone.try(:strip),
- email: x.email.try(:strip),
- billing_email: x.billing_address.try(:strip),
- country_code: x.country.try(:strip),
- state: x.stateorprovince.try(:strip),
- city: x.city.try(:strip),
- street: x.street1.try(:strip),
- zip: x.postalcode.try(:strip),
- url: x.url.try(:strip),
- accounting_customer_code: x.directo_handle.try(:strip),
- legacy_id: x.id,
- creator_str: user,
- updator_str: user,
- code: x.handle.upcase
- })
- end
-
- Registrar.import registrars, validate: false
-
- puts "-----> Generating reference numbers"
-
- Registrar.all.each do |x|
- x.save(validate: false)
- end
-
- puts "-----> Creating accounts numbers"
-
- Registrar.all.each do |x|
- next if x.cash_account
- x.accounts.create(account_type: Account::CASH, currency: 'EUR')
- x.save(validate: false)
-
- lr = Legacy::Registrar.find(x.legacy_id)
- x.cash_account.account_activities << AccountActivity.new({
- sum: lr.account_balance,
- currency: 'EUR',
- description: 'Transfer from legacy system'
- })
-
- x.cash_account.save
- end
-
- puts "-----> Imported #{count} new registrars in #{(Time.zone.now.to_f - start).round(2)} seconds"
- end
-
- desc 'Import users'
- task users: :environment do
- start = Time.zone.now.to_f
- puts "-----> Importing users and IP's..."
-
- id_users = []
- users = []
- ips = []
- temp = []
-
- existing_ids = ApiUser.pluck(:legacy_id)
- existing_ips = WhiteIp.pluck(:ipv4)
-
- Legacy::Registrar.all.each do |x|
-
- x.acl.all.each do |y|
-
- next if existing_ids.include?(y.id)
-
- if y.try(:cert) != 'pki'
-
- if y.try(:cert) == 'idkaart'
- id_users << ApiUser.new({
- username: y.try(:password) ? y.try(:password) : y.try(:password),
- plain_text_password: ('a'..'z').to_a.shuffle.first(8).join,
- identity_code: y.try(:password) ? y.try(:password) : y.try(:password),
- registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id),
- roles: ['billing'],
- legacy_id: y.try(:id)
- })
- else
- temp << ApiUser.new({
- username: x.handle.try(:strip),
- plain_text_password: y.try(:password) ? y.try(:password) : ('a'..'z').to_a.shuffle.first(8).join,
- registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id),
- roles: ['epp'],
- legacy_id: y.try(:id)
- })
- end
- end
- temp = temp.reverse!.uniq{|u| u.username }
- end
- users = temp
-
- x.acl.all.each do |y|
- next if existing_ips.include?(y.ipaddr)
- if !y.ipaddr.nil? && y.ipaddr != ''
-
- y.ipaddr.split(',').each do |ip|
- ips << WhiteIp.new({
- registrar_id: Registrar.find_by(legacy_id: x.try(:id)).try(:id),
- ipv4: ip,
- interfaces: ['api', 'registrar']
- })
-
- end
- end
- end
- end
-
- ApiUser.import id_users, validate: false
- ApiUser.import users, validate: false
-
- if ips
- WhiteIp.import ips, validate: false
- end
-
- puts "-----> Imported #{id_users.count} billing users and #{users.count} epp users"
- puts "-----> Imported #{ips.count} white IP's in #{(Time.zone.now.to_f - start).round(2)} seconds"
-
- end
-
- desc 'Import contacts'
- task contacts: :environment do
- start = Time.zone.now.to_f
- puts '-----> Importing contacts...'
-
- # 1;"RC";"born number" # not used
- # 2;"OP";"identity card number" -> priv
- # 3;"PASS";"passwport" ->
- # 4;"ICO";"organization identification number"
- # 5;"MPSV";"social system identification" # not used
- # 6;"BIRTHDAY";"day of birth"
-
- ident_type_map = {
- 2 => Contact::PRIV,
- 3 => Contact::PASSPORT,
- 4 => Contact::ORG,
- 6 => Contact::BIRTHDAY
- }
-
- contact_columns = %w(
- code
- phone
- email
- fax
- created_at
- updated_at
- ident
- ident_type
- auth_info
- name
- registrar_id
- creator_str
- updator_str
- legacy_id
- street
- city
- zip
- state
- country_code
- statuses
- )
-
- contacts = []
- existing_contact_ids = Contact.pluck(:legacy_id)
- count = 0
-
- Legacy::Contact.includes(:object_registry, :object, object_registry: :registrar)
- .find_each(batch_size: 10000).with_index do |x, index|
-
- next if existing_contact_ids.include?(x.id)
- count += 1
-
- if 4 == x.ssntype
- name = x.organization.try(:strip).presence || x.name.try(:strip).presence
- else
- name = x.name.try(:strip).presence || x.organization.try(:strip).presence
- end
-
- begin
- contacts << [
- x.object_registry.name.try(:strip),
- x.telephone.try(:strip),
- [x.email.try(:strip), x.notifyemail.try(:strip)].uniq.select(&:present?).join(', '),
- x.fax.try(:strip),
- x.object_registry.try(:crdate),
- x.object.read_attribute(:update).nil? ? x.object_registry.try(:crdate) : x.object.read_attribute(:update),
- x.ssn.try(:strip),
- ident_type_map[x.ssntype],
- x.object.authinfopw.try(:strip),
- name,
- Registrar.find_by(legacy_id: x.object.try(:clid)).try(:id),
- x.object_registry.try(:registrar).try(:name),
- x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
- x.id,
- [x.street1.try(:strip), x.street2.try(:strip), x.street3.try(:strip)].compact.join(", "),
- x.city.try(:strip),
- x.postalcode.try(:strip),
- x.stateorprovince.try(:strip),
- x.country.try(:strip),
- [x.object_state.try(:name), Contact::OK].compact
- ]
-
- if contacts.size % 10000 == 0
- Contact.import contact_columns, contacts, {validate: false, timestamps: false}
- contacts = []
- end
- rescue => e
- puts "ERROR on index #{index}"
- puts e
- end
- end
-
- Contact.import contact_columns, contacts, {validate: false, timestamps: false}
- puts "-----> Imported #{count} new contacts in #{(Time.zone.now.to_f - start).round(2)} seconds"
- end
-
- desc 'Import reserved'
- task reserved: :environment do
- start = Time.zone.now.to_f
- puts '-----> Importing reserved domains...'
-
- reserved_domains = []
- count = 0
-
- existing_ids = ReservedDomain.pluck(:legacy_id)
-
- Legacy::Domain.includes(
- :object_registry,
- :object
- ).find_each(batch_size: 1000).with_index do |x, index|
-
- next if existing_ids.include?(x.id) || Registrar.find_by(legacy_id: x.object.try(:clid)).try(:name) != 'eedirect'
- count += 1
-
- reserved_domains << ReservedDomain.new({
- created_at: x.object_registry.try(:crdate),
- updated_at: x.object.read_attribute(:update).nil? ? x.object_registry.try(:crdate) : x.object.read_attribute(:update),
- creator_str: x.object_registry.try(:registrar).try(:name),
- updator_str: x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
- names: '"' + x.object_registry.name.try(:strip) + '"=>"' + SecureRandom.hex + '"',
- legacy_id: x.id
- })
-
- if index % 1000 == 0 && index != 0
- ReservedDomain.import reserved_domains, {validate: false, timestamps: false}
- reserved_domains = []
- end
- end
- ReservedDomain.import reserved_domains, {validate: false, timestamps: false}
- puts "-----> Imported #{count} new reserved domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
- end
-
- desc 'Import domains'
- task domains: :environment do
- start = Time.zone.now.to_f
- puts '-----> Importing domains...'
-
- domain_columns = %w(
- name
- registrar_id
- registered_at
- valid_to
- transfer_code
- created_at
- updated_at
- name_dirty
- name_puny
- period
- period_unit
- creator_str
- updator_str
- legacy_id
- legacy_registrar_id
- legacy_registrant_id
- statuses
- )
-
- domain_contact_columns = %w(
- type
- creator_str
- updator_str
- legacy_domain_id
- legacy_contact_id
- )
-
- domain_status_columns = %w(
- description
- value
- creator_str
- updator_str
- legacy_domain_id
- )
-
- nameserver_columns = %w(
- hostname
- ipv4
- ipv6
- creator_str
- updator_str
- legacy_domain_id
- created_at
- updated_at
- )
-
- dnskey_columns = %w(
- flags
- protocol
- alg
- public_key
- creator_str
- updator_str
- legacy_domain_id
- updated_at
- )
-
- domains, nameservers, dnskeys, domain_contacts = [], [], [], []
- existing_domain_ids = Domain.pluck(:legacy_id)
- user = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
- count = 0
-
- Legacy::Domain.includes(
- :object_registry,
- :object,
- :nsset,
- :object_states,
- :dnskeys,
- :domain_contact_maps,
- nsset: { hosts: :host_ipaddr_maps }
- ).find_each(batch_size: 10000).with_index do |x, index|
- next if existing_domain_ids.include?(x.id) || Registrar.find_by(legacy_id: x.object.try(:clid)).try(:name) == 'eedirect'
- count += 1
-
- begin
- # domain statuses
- domain_statuses = []
- x.object_states.each do |state|
- next if state.name.blank?
- domain_statuses << state.name
- end
-
- # OK status is default
- domain_statuses << DomainStatus::OK if domain_statuses.empty?
-
- domains << [
- x.object_registry.name.try(:strip),
- Registrar.find_by(legacy_id: x.object.try(:clid)).try(:id),
- x.object_registry.try(:crdate),
- x.object_registry.try(:crdate),
- x.exdate,
- x.object.authinfopw.try(:strip),
- x.object_registry.try(:crdate),
- x.object.read_attribute(:update).nil? ? x.object_registry.try(:crdate) : x.object.read_attribute(:update),
- x.object_registry.name.try(:strip),
- SimpleIDN.to_ascii(x.object_registry.name.try(:strip)),
- 1,
- 'y',
- x.object_registry.try(:registrar).try(:name),
- x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
- x.id,
- x.object_registry.try(:crid),
- x.registrant,
- domain_statuses
- ]
-
- # admin contacts
- x.domain_contact_maps.each do |dc|
- domain_contacts << [
- 'AdminDomainContact',
- x.object_registry.try(:registrar).try(:name),
- x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
- x.id,
- dc.contactid
- ]
- end
-
- # tech contacts
- x.nsset_contact_maps.each do |dc|
- domain_contacts << [
- 'TechDomainContact',
- x.object_registry.try(:registrar).try(:name),
- x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
- x.id,
- dc.contactid
- ]
- end
-
- # nameservers
- nsset = x.nsset
- nsset.hosts.each do |host|
- ip_maps = host.host_ipaddr_maps
- ips = {
- ipv4: [],
- ipv6: [],
- }
- ip_maps.each do |ip_map|
- next unless ip_map.ipaddr
- ips[:ipv4] << ip_map.ipaddr.to_s.strip if ip_map.ipaddr.ipv4?
- ips[:ipv6] << ip_map.ipaddr.to_s.strip if ip_map.ipaddr.ipv6?
- end
-
- nameservers << [
- host.fqdn.try(:strip),
- ips[:ipv4],
- ips[:ipv6],
- x.object_registry.try(:registrar).try(:name),
- x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
- x.id,
- nsset.object_registry.try(:crdate),
- nsset.object_registry.try(:object_history).read_attribute(:update).nil? ? nsset.object_registry.try(:crdate) : nsset.object_registry.try(:object_history).read_attribute(:update)
- ]
- end if x.nsset && x.nsset.hosts
-
- x.dnskeys.each do |key|
- dnskeys << [
- key.flags,
- key.protocol,
- key.alg,
- key.key,
- x.object_registry.try(:registrar).try(:name),
- x.object.try(:registrar).try(:name) ? x.object.try(:registrar).try(:name) : x.object_registry.try(:registrar).try(:name),
- x.id,
- key.object_registry.try(:object_history).read_attribute(:update).nil? ? key.try(:crdate)||Time.zone.now : key.object_registry.try(:object_history).read_attribute(:update)
- ]
- end
-
- if index % 10000 == 0 && index != 0
- Domain.import domain_columns, domains, {validate: false, timestamps: false}
- Nameserver.import nameserver_columns, nameservers, {validate: false, timestamps: false}
- Dnskey.import dnskey_columns, dnskeys, {validate: false, timestamps: false}
- DomainContact.import domain_contact_columns, domain_contacts, validate: false # created_at is taken from contact at the bottom
- domains, nameservers, dnskeys, domain_contacts = [], [], [], []
- end
- rescue => e
- puts "ERROR on index #{index}"
- puts e
- end
- end
-
- Domain.import domain_columns, domains, {validate: false, timestamps: false}
- Nameserver.import nameserver_columns, nameservers, {validate: false, timestamps: false}
- Dnskey.import dnskey_columns, dnskeys, {validate: false, timestamps: false}
- DomainContact.import domain_contact_columns, domain_contacts, validate: false
-
- puts '-----> Updating relations...'
-
- # registrant
- ActiveRecord::Base.connection.execute(
- "UPDATE domains "\
- "SET registrant_id = contacts.id "\
- "FROM contacts "\
- "WHERE contacts.legacy_id = legacy_registrant_id "\
- "AND legacy_registrant_id IS NOT NULL "\
- "AND registrant_id IS NULL"
- )
-
- # registrar
- ActiveRecord::Base.connection.execute(
- "UPDATE domains "\
- "SET registrar_id = registrars.id "\
- "FROM registrars "\
- "WHERE registrars.legacy_id = legacy_registrar_id "\
- "AND legacy_registrar_id IS NOT NULL "\
- "AND registrar_id IS NULL"
- )
-
- # contacts
- ActiveRecord::Base.connection.execute(
- "UPDATE domain_contacts "\
- "SET contact_id = contacts.id, "\
- "updated_at = contacts.updated_at, "\
- "created_at = contacts.created_at "\
- "FROM contacts "\
- "WHERE contacts.legacy_id = legacy_contact_id "\
- "AND legacy_contact_id IS NOT NULL "\
- "AND contact_id IS NULL"
- )
-
- ActiveRecord::Base.connection.execute(
- "UPDATE domain_contacts "\
- "SET domain_id = domains.id "\
- "FROM domains "\
- "WHERE domains.legacy_id = legacy_domain_id "\
- "AND legacy_domain_id IS NOT NULL "\
- "AND domain_id IS NULL"
- )
-
- # nameservers
- ActiveRecord::Base.connection.execute(
- "UPDATE nameservers "\
- "SET domain_id = domains.id "\
- "FROM domains "\
- "WHERE domains.legacy_id = legacy_domain_id "\
- "AND legacy_domain_id IS NOT NULL "\
- "AND domain_id IS NULL"
- )
-
- # dnskeys
- ActiveRecord::Base.connection.execute(
- "UPDATE dnskeys "\
- "SET domain_id = domains.id "\
- "FROM domains "\
- "WHERE domains.legacy_id = legacy_domain_id "\
- "AND legacy_domain_id IS NOT NULL "\
- "AND domain_id IS NULL"
- )
-
- puts '-----> Generating dnskey digests...'
-
- Dnskey.all.each do |ds|
- ds.generate_digest
- ds.generate_ds_key_tag
- ds.save(validate: false)
- end
-
- puts "-----> Imported #{count} new domains in #{(Time.zone.now.to_f - start).round(2)} seconds"
- end
-
- desc 'Import zones'
- task zones: :environment do
- start = Time.zone.now.to_f
- puts '-----> Importing zones...'
-
- ns_records, a_records, a4_records = parse_zone_ns_data('ee', 1)
-
- DNS::Zone.create!({
- origin: 'ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # edu.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('edu.ee', 6)
-
- DNS::Zone.create!({
- origin: 'edu.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # aip.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('aip.ee', 9)
-
- DNS::Zone.create!({
- origin: 'aip.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # org.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('org.ee', 10)
-
- DNS::Zone.create!({
- origin: 'org.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # pri.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('pri.ee', 2)
-
- DNS::Zone.create!({
- origin: 'pri.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # med.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('med.ee', 3)
-
- DNS::Zone.create!({
- origin: 'med.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # fie.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('fie.ee', 4)
-
- DNS::Zone.create!({
- origin: 'fie.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # com.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('com.ee', 5)
-
- DNS::Zone.create!({
- origin: 'com.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # gov.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('gov.ee', 7)
-
- DNS::Zone.create!({
- origin: 'gov.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- # riik.ee
- ns_records, a_records, a4_records = parse_zone_ns_data('riik.ee', 8)
-
- DNS::Zone.create!({
- origin: 'riik.ee',
- ttl: 43200,
- refresh: 3600,
- retry: 900,
- expire: 1209600,
- minimum_ttl: 3600,
- email: 'hostmaster.eestiinternet.ee',
- master_nameserver: 'ns.tld.ee',
- ns_records: ns_records,
- a_records: a_records,
- a4_records: a4_records
- })
-
- puts "-----> Imported zones in #{(Time.zone.now.to_f - start).round(2)} seconds"
- end
-end
-
-def parse_zone_ns_data(domain, zone)
- ns_records = ''
- a_records = ''
- a4_records = ''
- Legacy::ZoneNs.where(zone: zone).each do |x|
- ipv4 = x.addrs.select { |addr| addr.ipv4? }.first
- ipv6 = x.addrs.select { |addr| addr.ipv6? }.first
-
- ns_records += "#{domain}. IN NS #{x.fqdn}.\n"
- a_records += "#{x.fqdn}. IN A #{ipv4}\n" if ipv4.present?
- a4_records += "#{x.fqdn}. IN AAAA #{ipv6}\n" if ipv6.present?
- end
- [ns_records.strip, a_records.strip, a4_records.strip]
-end
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
index ea3b6dff5f..036ecd3829 100644
--- a/test/application_system_test_case.rb
+++ b/test/application_system_test_case.rb
@@ -20,7 +20,7 @@ class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase
self.use_transactional_fixtures = false
DatabaseCleaner.strategy = :truncation
- Capybara.register_driver(:chrome) do |_app|
+ Capybara.register_driver(:chrome) do |app|
options = ::Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
@@ -28,13 +28,10 @@ class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--window-size=1400,1400')
- Capybara::Selenium::Driver.new(Rails.application, browser: :chrome, options: options)
+ Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end
- Capybara.register_server(:silent_puma) do |app, port, _host|
- require 'rack/handler/puma'
- Rack::Handler::Puma.run(app, Port: port, Threads: '0:2', Silent: true)
- end
+ Capybara.server = :puma, { Silent: true }
def setup
DatabaseCleaner.start
@@ -42,7 +39,6 @@ def setup
super
Capybara.current_driver = :chrome
- Capybara.server = :silent_puma
end
def teardown
diff --git a/test/fixtures/domains.yml b/test/fixtures/domains.yml
index bbf5ced40d..87059e68a1 100644
--- a/test/fixtures/domains.yml
+++ b/test/fixtures/domains.yml
@@ -1,5 +1,6 @@
shop:
name: shop.test
+ name_puny: shop.test
name_dirty: shop.test
registrar: bestnames
registrant: john
@@ -15,6 +16,7 @@ shop:
airport:
name: airport.test
+ name_puny: airport.test
name_dirty: airport.test
registrar: bestnames
registrant: john
@@ -26,6 +28,7 @@ airport:
library:
name: library.test
+ name_puny: library.test
name_dirty: library.test
registrar: bestnames
registrant: acme_ltd
@@ -37,6 +40,7 @@ library:
metro:
name: metro.test
+ name_puny: metro.test
name_dirty: metro.test
registrar: goodnames
registrant: jack
@@ -48,6 +52,7 @@ metro:
hospital:
name: hospital.test
+ name_puny: hospital.test
name_dirty: hospital.test
registrar: goodnames
registrant: john
@@ -59,6 +64,8 @@ hospital:
invalid:
name: invalid.test
+ name_puny: invalid.test
+ name_dirty: invalid.test
transfer_code: 1438d6
valid_to: <%= Time.zone.parse('2010-07-05').utc.to_s(:db) %>
registrar: bestnames
diff --git a/test/integration/epp/base_test.rb b/test/integration/epp/base_test.rb
index a07ab767c3..6d85318701 100644
--- a/test/integration/epp/base_test.rb
+++ b/test/integration/epp/base_test.rb
@@ -50,7 +50,7 @@ def test_anonymous_user
XML
- post '/epp/command/info', { frame: xml_of_epp_command_that_requires_authentication },
+ post epp_info_path, { frame: xml_of_epp_command_that_requires_authentication },
'HTTP_COOKIE' => 'session=non-existent'
assert_epp_response :authorization_error
@@ -74,7 +74,7 @@ def test_non_authorized_user
XML
- post '/epp/command/info', { frame: xml_of_epp_command_that_requires_authorization },
+ post epp_info_path, { frame: xml_of_epp_command_that_requires_authorization },
'HTTP_COOKIE' => "session=#{session.session_id}"
assert_epp_response :authorization_error
@@ -83,7 +83,7 @@ def test_non_authorized_user
private
def valid_command_path
- epp_command_poll_path
+ epp_poll_path
end
def valid_request_xml
diff --git a/test/integration/epp/contact/base_test.rb b/test/integration/epp/contact/base_test.rb
index c332e7b361..ef10fdb35a 100644
--- a/test/integration/epp/contact/base_test.rb
+++ b/test/integration/epp/contact/base_test.rb
@@ -14,7 +14,7 @@ def test_non_existent_contact
XML
- post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_does_not_exist
end
diff --git a/test/integration/epp/contact/check/base_test.rb b/test/integration/epp/contact/check/base_test.rb
index 03fa7aba8c..4e630c94c1 100644
--- a/test/integration/epp/contact/check/base_test.rb
+++ b/test/integration/epp/contact/check/base_test.rb
@@ -21,7 +21,7 @@ def test_returns_valid_response
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
@@ -42,7 +42,7 @@ def test_contact_is_available
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '1', response_xml.at_xpath('//contact:id', contact: xml_schema)['avail']
@@ -65,7 +65,7 @@ def test_contact_is_unavailable
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//contact:id', contact: xml_schema)['avail']
@@ -88,7 +88,7 @@ def test_multiple_contacts
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal 3, response_xml.xpath('//contact:cd', contact: xml_schema).size
diff --git a/test/integration/epp/contact/create/base_test.rb b/test/integration/epp/contact/create/base_test.rb
index 68b30371a1..1f749123cb 100644
--- a/test/integration/epp/contact/create/base_test.rb
+++ b/test/integration/epp/contact/create/base_test.rb
@@ -29,7 +29,7 @@ def test_creates_new_contact_with_required_attributes
XML
assert_difference 'Contact.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :completed_successfully
@@ -68,7 +68,7 @@ def test_respects_custom_code
XML
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}"
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}"
contact = Contact.find_by(name: name)
assert_equal "#{session.user.registrar.code}:#{code}".upcase, contact.code
@@ -98,7 +98,7 @@ def test_fails_when_required_attributes_are_missing
XML
assert_no_difference 'Contact.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :required_parameter_missing
end
diff --git a/test/integration/epp/contact/delete/base_test.rb b/test/integration/epp/contact/delete/base_test.rb
index 442d16a637..d8ce06c95f 100644
--- a/test/integration/epp/contact/delete/base_test.rb
+++ b/test/integration/epp/contact/delete/base_test.rb
@@ -21,7 +21,7 @@ def test_deletes_contact
XML
assert_difference 'Contact.count', -1 do
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :completed_successfully
end
@@ -47,7 +47,7 @@ def test_undeletable_cannot_be_deleted
XML
assert_no_difference 'Contact.count' do
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :object_association_prohibits_operation
end
diff --git a/test/integration/epp/contact/info/base_test.rb b/test/integration/epp/contact/info/base_test.rb
index d535d14d5e..6bfcc896df 100644
--- a/test/integration/epp/contact/info/base_test.rb
+++ b/test/integration/epp/contact/info/base_test.rb
@@ -29,7 +29,7 @@ def test_returns_valid_response
XML
- post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
diff --git a/test/integration/epp/contact/transfer/base_test.rb b/test/integration/epp/contact/transfer/base_test.rb
new file mode 100644
index 0000000000..e76fce5e45
--- /dev/null
+++ b/test/integration/epp/contact/transfer/base_test.rb
@@ -0,0 +1,23 @@
+require 'test_helper'
+
+class EppContactTransferBaseTest < EppTestCase
+ # https://github.com/internetee/registry/issues/676
+ def test_not_implemented
+ request_xml = <<-XML
+
+
+
+
+
+ any
+
+
+
+
+ XML
+
+ post epp_transfer_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+
+ assert_epp_response :unimplemented
+ end
+end
diff --git a/test/integration/epp/contact/update/base_test.rb b/test/integration/epp/contact/update/base_test.rb
index 7f76a310fc..ad5e588625 100644
--- a/test/integration/epp/contact/update/base_test.rb
+++ b/test/integration/epp/contact/update/base_test.rb
@@ -37,7 +37,7 @@ def test_updates_contact
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@contact.reload
assert_epp_response :completed_successfully
@@ -69,7 +69,7 @@ def test_notifies_contact_by_email_when_email_is_changed
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_emails 1
end
@@ -97,7 +97,7 @@ def test_skips_notifying_contact_when_email_is_not_changed
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_no_emails
end
@@ -128,7 +128,7 @@ def test_skips_notifying_a_contact_when_a_contact_is_not_a_registrant
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_no_emails
end
@@ -154,7 +154,7 @@ def test_non_existing_contact
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_does_not_exist
end
@@ -188,7 +188,7 @@ def test_ident_code_cannot_be_updated
XML
assert_no_changes -> { @contact.updated_at } do
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :data_management_policy_violation
end
@@ -220,7 +220,7 @@ def test_ident_type_and_ident_country_code_can_be_updated_when_absent
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :completed_successfully
end
diff --git a/test/integration/epp/domain/base_test.rb b/test/integration/epp/domain/base_test.rb
index b12fcf8da2..125e173a79 100644
--- a/test/integration/epp/domain/base_test.rb
+++ b/test/integration/epp/domain/base_test.rb
@@ -14,7 +14,7 @@ def test_non_existent_domain
XML
- post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_does_not_exist
end
diff --git a/test/integration/epp/domain/check/auction_test.rb b/test/integration/epp/domain/check/auction_test.rb
index d52a656293..7b4dcb595a 100644
--- a/test/integration/epp/domain/check/auction_test.rb
+++ b/test/integration/epp/domain/check/auction_test.rb
@@ -28,7 +28,7 @@ def test_domain_is_unavailable_when_at_auction
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
@@ -52,7 +52,7 @@ def test_idn_ascii_domain_is_unavailable_when_at_auction
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
@@ -76,7 +76,7 @@ def test_idn_unicode_domain_is_unavailable_when_at_auction
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
@@ -100,7 +100,7 @@ def test_domain_is_unavailable_when_awaiting_payment
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
@@ -124,7 +124,7 @@ def test_domain_is_available_when_payment_received
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
diff --git a/test/integration/epp/domain/check/base_test.rb b/test/integration/epp/domain/check/base_test.rb
index fc8eaaca0b..bed7a5b2f4 100644
--- a/test/integration/epp/domain/check/base_test.rb
+++ b/test/integration/epp/domain/check/base_test.rb
@@ -15,7 +15,7 @@ def test_returns_valid_response
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
@@ -36,7 +36,7 @@ def test_domain_is_available_when_not_registered_or_blocked
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
@@ -59,7 +59,7 @@ def test_domain_is_available_when_reserved
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
@@ -80,7 +80,7 @@ def test_domain_is_unavailable_when_format_is_invalid
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
@@ -103,7 +103,7 @@ def test_domain_is_unavailable_when_registered
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
@@ -126,7 +126,7 @@ def test_domain_is_unavailable_when_blocked
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
@@ -149,7 +149,7 @@ def test_domain_is_unavailable_when_zone_with_the_same_origin_exists
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
@@ -172,7 +172,7 @@ def test_multiple_domains
XML
- post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal 3, response_xml.xpath('//domain:cd', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').size
diff --git a/test/integration/epp/domain/create/auction_idn_test.rb b/test/integration/epp/domain/create/auction_idn_test.rb
index d4c49d66dc..c5e9f840c7 100644
--- a/test/integration/epp/domain/create/auction_idn_test.rb
+++ b/test/integration/epp/domain/create/auction_idn_test.rb
@@ -39,7 +39,7 @@ def test_domain_with_ascii_idn_cannot_be_registered_without_registration_code
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
refute Domain.where(name: @idn_auction.domain).exists?
@@ -73,7 +73,7 @@ def test_domain_with_unicode_idn_cannot_be_registered_without_registration_code
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
refute Domain.where(name: @idn_auction.domain).exists?
@@ -106,7 +106,7 @@ def test_domain_with_ascii_idn_cannot_be_registered_without_winning_the_auction
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
refute Domain.where(name: @idn_auction.domain).exists?
@@ -139,7 +139,7 @@ def test_domain_with_unicode_idn_cannot_be_registered_without_winning_the_auctio
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
refute Domain.where(name: @idn_auction.domain).exists?
@@ -176,7 +176,7 @@ def test_registers_unicode_domain_with_correct_registration_code_when_payment_is
XML
assert_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
@idn_auction.reload
@@ -212,7 +212,7 @@ def test_registers_ascii_domain_with_correct_registration_code_when_payment_is_r
XML
assert_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
@idn_auction.reload
diff --git a/test/integration/epp/domain/create/auction_test.rb b/test/integration/epp/domain/create/auction_test.rb
index 73104c0bb3..863f473a71 100644
--- a/test/integration/epp/domain/create/auction_test.rb
+++ b/test/integration/epp/domain/create/auction_test.rb
@@ -31,7 +31,7 @@ def test_registers_domain_without_registration_code_when_not_at_auction
XML
assert_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :completed_successfully
end
@@ -68,7 +68,7 @@ def test_registers_domain_with_correct_registration_code_after_another_auction_w
XML
assert_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :completed_successfully
end
@@ -100,7 +100,7 @@ def test_registers_domain_with_correct_registration_code_when_payment_is_receive
XML
assert_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
@auction.reload
@@ -132,7 +132,7 @@ def test_domain_cannot_be_registered_without_registration_code
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :required_parameter_missing
end
@@ -164,7 +164,7 @@ def test_domain_cannot_be_registered_with_wrong_registration_code
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :invalid_authorization_information
end
@@ -195,7 +195,7 @@ def test_domain_cannot_be_registered_when_payment_is_not_received
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :required_parameter_missing
end
@@ -222,7 +222,7 @@ def test_domain_cannot_be_registered_when_at_auction
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :parameter_value_policy_error
end
diff --git a/test/integration/epp/domain/create/base_test.rb b/test/integration/epp/domain/create/base_test.rb
index 43db1e53e2..8e4d28d7a6 100644
--- a/test/integration/epp/domain/create/base_test.rb
+++ b/test/integration/epp/domain/create/base_test.rb
@@ -5,7 +5,8 @@ def test_registers_new_domain_with_required_attributes
now = Time.zone.parse('2010-07-05')
travel_to now
name = "new.#{dns_zones(:one).origin}"
- registrant = contacts(:john).becomes(Registrant)
+ contact = contacts(:john)
+ registrant = contact.becomes(Registrant)
request_xml = <<-XML
@@ -27,7 +28,7 @@ def test_registers_new_domain_with_required_attributes
XML
assert_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :completed_successfully
@@ -35,6 +36,8 @@ def test_registers_new_domain_with_required_attributes
domain = Domain.find_by(name: name)
assert_equal name, domain.name
assert_equal registrant, domain.registrant
+ assert_equal [contact], domain.admin_contacts
+ assert_equal [contact], domain.tech_contacts
assert_not_empty domain.transfer_code
default_registration_period = 1.year + 1.day
@@ -68,7 +71,7 @@ def test_registers_reserved_domain_with_registration_code
XML
assert_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :completed_successfully
@@ -102,7 +105,7 @@ def test_respects_custom_transfer_code
XML
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :completed_successfully
assert_equal transfer_code, Domain.find_by(name: name).transfer_code
@@ -132,7 +135,7 @@ def test_blocked_domain_cannot_be_registered
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :data_management_policy_violation
end
@@ -161,7 +164,7 @@ def test_reserved_domain_cannot_be_registered_with_wrong_registration_code
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :invalid_authorization_information
end
@@ -189,7 +192,7 @@ def test_reserved_domain_cannot_be_registered_without_registration_code
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :required_parameter_missing
end
@@ -217,7 +220,7 @@ def test_insufficient_funds
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}"
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}"
end
assert_epp_response :billing_failure
end
@@ -245,7 +248,7 @@ def test_no_price
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/create', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :billing_failure
end
diff --git a/test/integration/epp/domain/delete/base_test.rb b/test/integration/epp/domain/delete/base_test.rb
index 2ee71fcc26..0a70afe2e6 100644
--- a/test/integration/epp/domain/delete/base_test.rb
+++ b/test/integration/epp/domain/delete/base_test.rb
@@ -34,7 +34,7 @@ def test_bypasses_domain_and_registrant_and_contacts_validation
XML
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_includes Domain.find_by(name: 'invalid.test').statuses, DomainStatus::PENDING_DELETE_CONFIRMATION
assert_epp_response :completed_successfully_action_pending
end
@@ -62,7 +62,7 @@ def test_discarded_domain_cannot_be_deleted
XML
assert_no_difference 'Domain.count' do
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_epp_response :object_status_prohibits_operation
end
@@ -89,7 +89,7 @@ def test_requests_registrant_confirmation_when_required
XML
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert @domain.registrant_verification_asked?
@@ -120,7 +120,7 @@ def test_skips_registrant_confirmation_when_not_required
XML
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_not @domain.registrant_verification_asked?
@@ -151,7 +151,7 @@ def test_skips_registrant_confirmation_when_required_but_already_verified_by_reg
XML
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_not @domain.registrant_verification_asked?
@@ -176,7 +176,7 @@ def test_legal_document_is_required
XML
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :required_parameter_missing
end
@@ -203,7 +203,7 @@ def test_domain_cannot_be_deleted_when_explicitly_prohibited_by_registrar
XML
- post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_status_prohibits_operation
end
diff --git a/test/integration/epp/domain/info/base_test.rb b/test/integration/epp/domain/info/base_test.rb
index fd90177ca3..041c39cf32 100644
--- a/test/integration/epp/domain/info/base_test.rb
+++ b/test/integration/epp/domain/info/base_test.rb
@@ -21,7 +21,7 @@ def test_returns_valid_response
XML
- post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
@@ -49,7 +49,7 @@ def test_reveals_transfer_code_when_domain_is_owned_by_current_user
XML
- post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
@@ -76,7 +76,7 @@ def test_reveals_transfer_code_when_domain_is_not_owned_by_current_user_and_tran
XML
- post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_goodnames'
+ post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_goodnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
@@ -99,7 +99,7 @@ def test_conceals_transfer_code_when_domain_is_not_owned_by_current_user
XML
- post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_goodnames'
+ post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_goodnames'
response_xml = Nokogiri::XML(response.body)
assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw',
diff --git a/test/integration/epp/domain/renew/base_test.rb b/test/integration/epp/domain/renew/base_test.rb
index 537e697c9e..6c11f826e1 100644
--- a/test/integration/epp/domain/renew/base_test.rb
+++ b/test/integration/epp/domain/renew/base_test.rb
@@ -24,7 +24,7 @@ def test_renews_domain
XML
- post '/epp/command/renew', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
domain.reload
assert_epp_response :completed_successfully
@@ -50,7 +50,7 @@ def test_domain_cannot_be_renewed_when_invalid
XML
assert_no_changes -> { domain.valid_to } do
- post '/epp/command/renew', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
domain.reload
end
assert_epp_response :object_status_prohibits_operation
@@ -77,7 +77,7 @@ def test_domain_cannot_be_renewed_when_belongs_to_another_registrar
XML
assert_no_changes -> { domain.valid_to } do
- post '/epp/command/renew', { frame: request_xml },
+ post epp_renew_path, { frame: request_xml },
'HTTP_COOKIE' => "session=#{session.session_id}"
domain.reload
end
@@ -105,7 +105,7 @@ def test_insufficient_funds
XML
assert_no_difference -> { domain.valid_to } do
- post '/epp/command/renew', { frame: request_xml }, 'HTTP_COOKIE' =>
+ post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' =>
"session=#{session.session_id}"
domain.reload
end
@@ -132,7 +132,7 @@ def test_no_price
XML
assert_no_changes -> { domain.valid_to } do
- post '/epp/command/renew', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
domain.reload
end
assert_epp_response :billing_failure
@@ -158,7 +158,7 @@ def test_fails_when_provided_expiration_date_is_wrong
XML
assert_no_changes -> { domain.valid_to } do
- post '/epp/command/renew', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
domain.reload
end
assert_epp_response :parameter_value_policy_error
diff --git a/test/integration/epp/domain/transfer/query_test.rb b/test/integration/epp/domain/transfer/query_test.rb
index bd12937715..11e59d5ba3 100644
--- a/test/integration/epp/domain/transfer/query_test.rb
+++ b/test/integration/epp/domain/transfer/query_test.rb
@@ -2,7 +2,7 @@
class EppDomainTransferQueryTest < EppTestCase
def test_returns_domain_transfer_details
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
xml_doc = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
@@ -28,14 +28,14 @@ def test_wrong_transfer_code
XML
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :invalid_authorization_information
end
def test_no_domain_transfer
domains(:shop).transfers.delete_all
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :object_does_not_exist
end
diff --git a/test/integration/epp/domain/transfer/request_test.rb b/test/integration/epp/domain/transfer/request_test.rb
index 6a1b5a9f1f..caa0689995 100644
--- a/test/integration/epp/domain/transfer/request_test.rb
+++ b/test/integration/epp/domain/transfer/request_test.rb
@@ -13,24 +13,24 @@ def teardown
end
def test_transfers_domain_at_once
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :completed_successfully
end
def test_creates_new_domain_transfer
assert_difference -> { @domain.transfers.size } do
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
end
end
def test_approves_automatically_if_auto_approval_is_enabled
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_equal 'serverApproved', Nokogiri::XML(response.body).xpath('//domain:trStatus', 'domain' =>
'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
end
def test_assigns_new_registrar
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
@domain.reload
assert_equal @new_registrar, @domain.registrar
end
@@ -38,7 +38,7 @@ def test_assigns_new_registrar
def test_regenerates_transfer_code
@old_transfer_code = @domain.transfer_code
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
@domain.reload
refute_equal @domain.transfer_code, @old_transfer_code
@@ -48,31 +48,31 @@ def test_notifies_old_registrar
@old_registrar = @domain.registrar
assert_difference -> { @old_registrar.notifications.count } do
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
end
end
def test_duplicates_registrant_admin_and_tech_contacts
assert_difference -> { @new_registrar.contacts.size }, 3 do
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
end
end
def test_reuses_identical_contact
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_equal 1, @new_registrar.contacts.where(name: 'William').size
end
def test_saves_legal_document
assert_difference -> { @domain.legal_documents(true).size } do
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
end
end
def test_non_transferable_domain
@domain.update!(statuses: [DomainStatus::SERVER_TRANSFER_PROHIBITED])
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
domains(:shop).reload
assert_equal registrars(:bestnames), domains(:shop).registrar
@@ -82,7 +82,7 @@ def test_non_transferable_domain
def test_discarded_domain_cannot_be_transferred
@domain.update!(statuses: [DomainStatus::DELETE_CANDIDATE])
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
@domain.reload
assert_equal registrars(:bestnames), @domain.registrar
@@ -91,7 +91,7 @@ def test_discarded_domain_cannot_be_transferred
def test_same_registrar
assert_no_difference -> { @domain.transfers.size } do
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
end
assert_epp_response :use_error
end
@@ -113,7 +113,7 @@ def test_wrong_transfer_code
XML
- post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
+ post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
@domain.reload
assert_epp_response :invalid_authorization_information
diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb
index e68a623068..29fc1b875b 100644
--- a/test/integration/epp/domain/update/base_test.rb
+++ b/test/integration/epp/domain/update/base_test.rb
@@ -34,7 +34,7 @@ def test_update_domain
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_equal 'f0ff7d17b0', @domain.transfer_code
assert_epp_response :completed_successfully
@@ -56,7 +56,7 @@ def test_discarded_domain_cannot_be_updated
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_status_prohibits_operation
end
@@ -76,7 +76,7 @@ def test_does_not_return_server_delete_prohibited_status_when_pending_update_sta
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_status_prohibits_operation
response_xml = Nokogiri::XML(response.body)
@@ -109,7 +109,7 @@ def test_requires_verification_from_current_registrant_when_provided_registrant_
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_epp_response :completed_successfully_action_pending
@@ -145,7 +145,7 @@ def test_requires_verification_from_current_registrant_when_not_yet_verified_by_
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_epp_response :completed_successfully_action_pending
@@ -179,7 +179,7 @@ def test_skips_verification_when_provided_registrant_is_the_same_as_current_one
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_epp_response :completed_successfully
@@ -214,7 +214,7 @@ def test_skips_verification_when_disabled
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_epp_response :completed_successfully
@@ -250,7 +250,7 @@ def test_skips_verification_from_current_registrant_when_already_verified_by_reg
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_epp_response :completed_successfully
@@ -287,7 +287,7 @@ def test_deactivates_domain_when_all_name_servers_are_removed
XML
- post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
@domain.reload
assert_epp_response :completed_successfully
diff --git a/test/integration/epp/hello_test.rb b/test/integration/epp/hello_test.rb
index 1ccb65ff0a..c7d5356c29 100644
--- a/test/integration/epp/hello_test.rb
+++ b/test/integration/epp/hello_test.rb
@@ -9,7 +9,7 @@ def test_anonymous_user_is_able_to_access
XML
- get '/epp/session/hello', { frame: request_xml }, 'HTTP_COOKIE' => 'session=non-existent'
+ get epp_hello_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=non-existent'
response_xml = Nokogiri::XML(response.body)
assert_equal 'EPP server (EIS)', response_xml.at_css('greeting > svID').text
diff --git a/test/integration/epp/login/credentials_test.rb b/test/integration/epp/login/credentials_test.rb
index a9275e8e83..8ce6adcf21 100644
--- a/test/integration/epp/login/credentials_test.rb
+++ b/test/integration/epp/login/credentials_test.rb
@@ -24,7 +24,7 @@ def test_correct_credentials
XML
- post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
+ post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
assert EppSession.find_by(session_id: 'new_session_id')
assert_equal users(:api_bestnames), EppSession.find_by(session_id: 'new_session_id').user
assert_epp_response :completed_successfully
@@ -57,7 +57,7 @@ def test_wrong_credentials
XML
- post '/epp/session/login', { frame: request_xml }, 'HTTP_COOKIE' => 'session=any_random_string'
+ post epp_login_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=any_random_string'
assert_epp_response :authentication_error_server_closing_connection
end
diff --git a/test/integration/epp/login/password_change_test.rb b/test/integration/epp/login/password_change_test.rb
index 69cda0d6a3..5e557be816 100644
--- a/test/integration/epp/login/password_change_test.rb
+++ b/test/integration/epp/login/password_change_test.rb
@@ -25,7 +25,7 @@ def test_password_change
XML
- post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
+ post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
assert_equal 'new-password', users(:api_bestnames).plain_text_password
assert_epp_response :completed_successfully
end
diff --git a/test/integration/epp/login/session_limit_test.rb b/test/integration/epp/login/session_limit_test.rb
index a3db4f145d..79c0a8384c 100644
--- a/test/integration/epp/login/session_limit_test.rb
+++ b/test/integration/epp/login/session_limit_test.rb
@@ -14,7 +14,7 @@ def test_not_reached
end
assert_difference 'EppSession.count' do
- post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
+ post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
end
assert_epp_response :completed_successfully
end
@@ -27,7 +27,7 @@ def test_reached
end
assert_no_difference 'EppSession.count' do
- post '/epp/session/login', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
+ post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
end
assert_epp_response :authentication_error_server_closing_connection
end
diff --git a/test/integration/epp/logout_test.rb b/test/integration/epp/logout_test.rb
index bb6340c138..a578246ae2 100644
--- a/test/integration/epp/logout_test.rb
+++ b/test/integration/epp/logout_test.rb
@@ -2,22 +2,22 @@
class EppLogoutTest < EppTestCase
def test_success_response
- post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_epp_response :completed_successfully_ending_session
end
def test_ends_current_session
- post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_nil EppSession.find_by(session_id: 'api_bestnames')
end
def test_keeps_other_sessions_intact
- post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert EppSession.find_by(session_id: 'api_goodnames')
end
def test_anonymous_user
- post '/epp/session/logout', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=non-existent' }
+ post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=non-existent' }
assert_epp_response :authorization_error
end
diff --git a/test/integration/epp/poll_test.rb b/test/integration/epp/poll_test.rb
index ae31398f17..5ccd4258aa 100644
--- a/test/integration/epp/poll_test.rb
+++ b/test/integration/epp/poll_test.rb
@@ -15,7 +15,7 @@ def test_return_latest_notification_when_queue_is_not_empty
XML
- post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
xml_doc = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully_ack_to_dequeue
@@ -36,7 +36,7 @@ def test_return_action_data_when_present
XML
- post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
xml_doc = Nokogiri::XML(response.body)
namespace = 'https://epp.tld.ee/schema/changePoll-1.0.xsd'
@@ -60,7 +60,7 @@ def test_no_notifications
XML
- post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :completed_successfully_no_messages
end
@@ -77,7 +77,7 @@ def test_mark_as_read
XML
- post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
notification.reload
xml_doc = Nokogiri::XML(response.body)
@@ -98,7 +98,7 @@ def test_notification_of_other_registrars_cannot_be_marked_as_read
XML
- post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
notification.reload
assert notification.unread?
@@ -114,7 +114,7 @@ def test_notification_not_found
XML
- post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
+ post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_does_not_exist
end
diff --git a/test/integration/registrant_area/domains_test.rb b/test/integration/registrant_area/domains_test.rb
new file mode 100644
index 0000000000..11709dd5be
--- /dev/null
+++ b/test/integration/registrant_area/domains_test.rb
@@ -0,0 +1,25 @@
+require 'test_helper'
+
+class RegistrantAreaDomainsIntegrationTest < ApplicationIntegrationTest
+ setup do
+ sign_in users(:registrant)
+ end
+
+ def test_downloads_list_as_csv
+ get registrant_domains_path(format: :csv)
+
+ assert_response :ok
+ assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type']
+ assert_equal 'attachment; filename="domains.csv"', response.headers['Content-Disposition']
+ assert_not_empty response.body
+ end
+
+ def test_downloads_list_as_pdf
+ get registrant_domains_path(format: :pdf)
+
+ assert_response :ok
+ assert_equal Mime[:pdf], response.headers['Content-Type']
+ assert_equal 'attachment; filename="domains.pdf"', response.headers['Content-Disposition']
+ assert_not_empty response.body
+ end
+end
diff --git a/test/integration/registrar_area/contacts_test.rb b/test/integration/registrar_area/contacts_test.rb
new file mode 100644
index 0000000000..2597518b14
--- /dev/null
+++ b/test/integration/registrar_area/contacts_test.rb
@@ -0,0 +1,25 @@
+require 'test_helper'
+
+class RegistrarAreaContactsIntegrationTest < ApplicationIntegrationTest
+ setup do
+ sign_in users(:api_bestnames)
+ end
+
+ def test_downloads_list_as_csv
+ get registrar_contacts_path(format: :csv)
+
+ assert_response :ok
+ assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type']
+ assert_equal 'attachment; filename="contacts.csv"', response.headers['Content-Disposition']
+ assert_not_empty response.body
+ end
+
+ def test_downloads_list_as_pdf
+ get registrar_contacts_path(format: :pdf)
+
+ assert_response :ok
+ assert_equal Mime[:pdf], response.headers['Content-Type']
+ assert_equal 'attachment; filename="contacts.pdf"', response.headers['Content-Disposition']
+ assert_not_empty response.body
+ end
+end
diff --git a/test/integration/registrar_area/domains_test.rb b/test/integration/registrar_area/domains_test.rb
new file mode 100644
index 0000000000..eaa43e6749
--- /dev/null
+++ b/test/integration/registrar_area/domains_test.rb
@@ -0,0 +1,20 @@
+require 'test_helper'
+
+class RegistrarAreaDomainsIntegrationTest < ApplicationIntegrationTest
+ setup do
+ sign_in users(:api_bestnames)
+ end
+
+ def test_downloads_list_as_csv
+ now = Time.zone.parse('2010-07-05 08:00')
+ travel_to now
+
+ get registrar_domains_path(format: :csv)
+
+ assert_response :ok
+ assert_equal "#{Mime[:csv]}; charset=utf-8", response.headers['Content-Type']
+ assert_equal %(attachment; filename="Domains_#{l(now, format: :filename)}.csv"),
+ response.headers['Content-Disposition']
+ assert_not_empty response.body
+ end
+end
diff --git a/test/system/registrar_area/invoices/payment_callback_test.rb b/test/integration/registrar_area/invoices/payment_callback_test.rb
similarity index 95%
rename from test/system/registrar_area/invoices/payment_callback_test.rb
rename to test/integration/registrar_area/invoices/payment_callback_test.rb
index 620c4a245e..985b939147 100644
--- a/test/system/registrar_area/invoices/payment_callback_test.rb
+++ b/test/integration/registrar_area/invoices/payment_callback_test.rb
@@ -1,6 +1,6 @@
-require 'application_system_test_case'
+require 'test_helper'
-class PaymentCallbackTest < ApplicationSystemTestCase
+class PaymentCallbackTest < ApplicationIntegrationTest
def setup
super
diff --git a/test/system/registrar_area/invoices/payment_return_test.rb b/test/integration/registrar_area/invoices/payment_return_test.rb
similarity index 97%
rename from test/system/registrar_area/invoices/payment_return_test.rb
rename to test/integration/registrar_area/invoices/payment_return_test.rb
index 63e83a4b0c..b6317a0d05 100644
--- a/test/system/registrar_area/invoices/payment_return_test.rb
+++ b/test/integration/registrar_area/invoices/payment_return_test.rb
@@ -1,6 +1,6 @@
-require 'application_system_test_case'
+require 'test_helper'
-class PaymentReturnTest < ApplicationSystemTestCase
+class PaymentReturnTest < ApplicationIntegrationTest
def setup
super
diff --git a/test/mailers/previews/contact_mailer_preview.rb b/test/mailers/previews/contact_mailer_preview.rb
index 1e00ef6737..e2da0c8997 100644
--- a/test/mailers/previews/contact_mailer_preview.rb
+++ b/test/mailers/previews/contact_mailer_preview.rb
@@ -6,8 +6,9 @@ def email_changed
EXISTS(SELECT 1 FROM domain_contacts WHERE domain_contacts.contact_id =
contacts.id)')
- contact = contact.where.not(email: nil, country_code: nil, code: nil).first
+ contact = contact.where.not(email: nil, country_code: nil, ident_country_code: nil, code: nil)
+ .take
ContactMailer.email_changed(contact: contact, old_email: 'old@inbox.test')
end
-end
\ No newline at end of file
+end
diff --git a/test/mailers/previews/registrant_change_mailer_preview.rb b/test/mailers/previews/registrant_change_mailer_preview.rb
index dec948fe68..ac3dab2a97 100644
--- a/test/mailers/previews/registrant_change_mailer_preview.rb
+++ b/test/mailers/previews/registrant_change_mailer_preview.rb
@@ -1,7 +1,11 @@
class RegistrantChangeMailerPreview < ActionMailer::Preview
def initialize
- @domain = Domain.first
- @new_registrant = Registrant.where.not(email: nil, country_code: nil).first
+ @domain = Domain.joins(:registrant).where.not({ contacts: { email: nil,
+ country_code: nil,
+ ident_country_code: nil } }).take
+ @new_registrant = Registrant.where.not(email: nil,
+ country_code: nil,
+ ident_country_code: nil).take
super
end
@@ -21,7 +25,7 @@ def notification
def accepted
RegistrantChangeMailer.accepted(domain: @domain,
- old_registrant: @domain.registrar)
+ old_registrant: @domain.registrant)
end
def rejected
@@ -35,4 +39,4 @@ def expired
registrar: @domain.registrar,
registrant: @domain.registrant)
end
-end
\ No newline at end of file
+end
diff --git a/test/models/epp/response/result/code_test.rb b/test/models/epp/response/result/code_test.rb
index 556ff17ef0..3c75303f1e 100644
--- a/test/models/epp/response/result/code_test.rb
+++ b/test/models/epp/response/result/code_test.rb
@@ -38,6 +38,7 @@ def test_returns_code_values
parameter_value_range_error: 2004,
parameter_value_syntax_error: 2005,
billing_failure: 2104,
+ unimplemented: 2101,
object_is_not_eligible_for_renewal: 2105,
object_is_not_eligible_for_transfer: 2106,
authorization_error: 2201,
@@ -66,6 +67,7 @@ def test_returns_default_descriptions
2003 => 'Required parameter missing',
2004 => 'Parameter value range error',
2005 => 'Parameter value syntax error',
+ 2101 => 'Unimplemented command',
2104 => 'Billing failure',
2105 => 'Object is not eligible for renewal',
2106 => 'Object is not eligible for transfer',
diff --git a/test/models/invoice_test.rb b/test/models/invoice_test.rb
index 6e69711398..9c1c456108 100644
--- a/test/models/invoice_test.rb
+++ b/test/models/invoice_test.rb
@@ -11,7 +11,8 @@ def test_fixture_is_valid
def test_overdue_scope_returns_unpaid_uncancelled_invoices_with_past_due_date
travel_to Time.zone.parse('2010-07-05')
- @invoice.update!(account_activity: nil, cancelled_at: nil, due_date: '2010-07-04')
+ @invoice.update!(account_activity: nil, cancelled_at: nil, issue_date: '2010-07-04',
+ due_date: '2010-07-04')
assert Invoice.overdue.include?(@invoice), 'Should return overdue invoice'
end
@@ -108,4 +109,4 @@ def test_returns_combined_seller_address
seller_zip: nil)
assert_equal 'street, city, state', invoice.seller_address
end
-end
\ No newline at end of file
+end
diff --git a/test/services/overdue_invoice_canceller_test.rb b/test/services/overdue_invoice_canceller_test.rb
index debade3a91..bc34474842 100644
--- a/test/services/overdue_invoice_canceller_test.rb
+++ b/test/services/overdue_invoice_canceller_test.rb
@@ -2,7 +2,6 @@
class OverdueInvoiceCancellerTest < ActiveSupport::TestCase
setup do
- @invoice = invoices(:one)
@original_days_to_keep_overdue_invoices_active = Setting.days_to_keep_overdue_invoices_active
end
@@ -28,26 +27,24 @@ def test_uses_configured_delay
def test_cancels_overdue_invoices
travel_to Time.zone.parse('2010-07-05')
- @invoice.update!(account_activity: nil, cancelled_at: nil, due_date: '2010-07-03')
- assert @invoice.cancellable?
+ invoice = cancellable_invoice(due_date: '2010-07-03')
canceller = OverdueInvoiceCanceller.new(delay: 1.day)
canceller.cancel
- @invoice.reload
+ invoice.reload
- assert @invoice.cancelled?
+ assert invoice.cancelled?
end
def test_yields_cancelled_invoices
travel_to Time.zone.parse('2010-07-05')
- @invoice.update!(account_activity: nil, cancelled_at: nil, due_date: '2010-07-03')
- assert @invoice.cancellable?
+ invoice = cancellable_invoice(due_date: '2010-07-03')
canceller = OverdueInvoiceCanceller.new(delay: 1.day)
iteration_count = 0
- canceller.cancel do |invoice|
- assert_equal @invoice, invoice
+ canceller.cancel do |cancelled_invoice|
+ assert_equal invoice, cancelled_invoice
iteration_count += 1
end
assert_equal 1, iteration_count
@@ -55,13 +52,21 @@ def test_yields_cancelled_invoices
def test_keeps_not_overdue_invoices_intact
travel_to Time.zone.parse('2010-07-05')
- @invoice.update!(account_activity: nil, cancelled_at: nil, due_date: '2010-07-04')
- assert @invoice.cancellable?
+ invoice = cancellable_invoice(due_date: '2010-07-04')
canceller = OverdueInvoiceCanceller.new(delay: 1.day)
canceller.cancel
- @invoice.reload
+ invoice.reload
- assert @invoice.not_cancelled?
+ assert invoice.not_cancelled?
end
-end
\ No newline at end of file
+
+ private
+
+ def cancellable_invoice(due_date:)
+ invoice = invoices(:one)
+ invoice.update!(account_activity: nil, cancelled_at: nil, issue_date: due_date,
+ due_date: due_date)
+ invoice
+ end
+end
diff --git a/test/system/admin_area/domain_versions_test.rb b/test/system/admin_area/domain_versions_test.rb
index b4e3daec8a..73db8d7075 100644
--- a/test/system/admin_area/domain_versions_test.rb
+++ b/test/system/admin_area/domain_versions_test.rb
@@ -21,9 +21,9 @@ def create_domain_with_history
INSERT INTO contacts (id, code, email, auth_info, registrar_id)
VALUES (54, 'test_code', 'test@inbox.test', '8b4d462aa04194ca78840a', #{@registrar.id});
- INSERT INTO domains (id, registrar_id, valid_to, registrant_id,
+ INSERT INTO domains (id, name, name_puny, name_dirty, registrar_id, valid_to, registrant_id,
transfer_code)
- VALUES (54, #{@registrar.id}, '2018-06-23T12:14:02.732+03:00', 54, 'transfer_code');
+ VALUES (54, 'any.test', 'any.test', 'any.test', #{@registrar.id}, '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, session, children)
diff --git a/test/system/registrar_area/domains_test.rb b/test/system/registrar_area/domains_test.rb
index 00d5c9e436..db51d7096f 100644
--- a/test/system/registrar_area/domains_test.rb
+++ b/test/system/registrar_area/domains_test.rb
@@ -14,7 +14,7 @@ def test_downloads_domain_list_as_csv
CSV
visit registrar_domains_url
- click_button 'Download as CSV'
+ click_button 'Download CSV'
assert_equal 'attachment; filename="Domains_2010-07-05_10.30.csv"', response_headers['Content-Disposition']
assert_equal expected_csv, page.body
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 361a1cab86..8af9a8cd67 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,7 +1,6 @@
if ENV['COVERAGE']
require 'simplecov'
SimpleCov.start 'rails' do
- add_filter '/app/models/legacy/'
add_filter '/app/models/version/'
add_filter '/lib/action_controller/'
add_filter '/lib/core_ext/'
diff --git a/vendor/bin/wkhtmltopdf b/vendor/bin/wkhtmltopdf
deleted file mode 100755
index 018966446c..0000000000
Binary files a/vendor/bin/wkhtmltopdf and /dev/null differ