mirror of
https://github.com/internetee/registry.git
synced 2025-06-03 11:17:30 +02:00
Merge pull request #1393 from internetee/upgrade-rails
Upgrade to Rails 5.0
This commit is contained in:
commit
b4be9e7f00
141 changed files with 1388 additions and 1664 deletions
|
@ -28,7 +28,6 @@ exclude_patterns:
|
|||
- "bin/"
|
||||
- "config/"
|
||||
- "db/"
|
||||
- "lib/action_controller/"
|
||||
- "lib/core_monkey_patches/"
|
||||
- "lib/daemons/"
|
||||
- "lib/gem_monkey_patches/"
|
||||
|
|
|
@ -22,8 +22,6 @@ before_script:
|
|||
- "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter"
|
||||
- "chmod +x ./cc-test-reporter"
|
||||
- "./cc-test-reporter before-build"
|
||||
script:
|
||||
- "bundle exec rake test"
|
||||
after_script:
|
||||
- "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
|
||||
services:
|
||||
|
|
3
Gemfile
3
Gemfile
|
@ -9,7 +9,7 @@ source 'https://rubygems.org'
|
|||
|
||||
# core
|
||||
gem 'iso8601', '0.8.6' # for dates and times
|
||||
gem 'rails', '4.2.11.1' # when update, all initializers eis_custom files needs check/update
|
||||
gem 'rails', '~> 5.0.7'
|
||||
gem 'rest-client'
|
||||
gem 'uglifier'
|
||||
|
||||
|
@ -66,7 +66,6 @@ gem 'daemons-rails', '1.2.1'
|
|||
gem 'que-web'
|
||||
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
|
||||
gem 'airbrake'
|
||||
|
||||
gem 'company_register', github: 'internetee/company_register', branch: :master
|
||||
|
|
218
Gemfile.lock
218
Gemfile.lock
|
@ -19,10 +19,10 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: https://github.com/internetee/epp-xml.git
|
||||
revision: 5dd542e67ef26d58365f30e553254d6db809277d
|
||||
revision: 27959f8cb244ea5eabaeeee747984988b454e840
|
||||
specs:
|
||||
epp-xml (1.1.0)
|
||||
activesupport (~> 4.1)
|
||||
activesupport (>= 4.1)
|
||||
builder (~> 3.2)
|
||||
|
||||
GIT
|
||||
|
@ -58,58 +58,58 @@ GIT
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.2.11.1)
|
||||
actionpack (= 4.2.11.1)
|
||||
actionview (= 4.2.11.1)
|
||||
activejob (= 4.2.11.1)
|
||||
actioncable (5.0.7.2)
|
||||
actionpack (= 5.0.7.2)
|
||||
nio4r (>= 1.2, < 3.0)
|
||||
websocket-driver (~> 0.6.1)
|
||||
actionmailer (5.0.7.2)
|
||||
actionpack (= 5.0.7.2)
|
||||
actionview (= 5.0.7.2)
|
||||
activejob (= 5.0.7.2)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.11.1)
|
||||
actionview (= 4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.0.7.2)
|
||||
actionview (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
rack (~> 2.0)
|
||||
rack-test (~> 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
actionview (5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
active_model-errors_details (1.3.1)
|
||||
activemodel (>= 3.2.13, < 5.0.0)
|
||||
activesupport
|
||||
activejob (4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.11.1)
|
||||
activemodel (= 4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.11.1)
|
||||
i18n (~> 0.7)
|
||||
activejob (5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
activerecord (5.0.7.2)
|
||||
activemodel (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
arel (~> 7.0)
|
||||
activesupport (5.0.7.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
airbrake (9.4.3)
|
||||
airbrake-ruby (~> 4.6)
|
||||
airbrake-ruby (4.6.0)
|
||||
airbrake (9.4.5)
|
||||
airbrake-ruby (~> 4.7)
|
||||
airbrake-ruby (4.7.1)
|
||||
rbtree3 (~> 0.5)
|
||||
akami (1.3.1)
|
||||
gyoku (>= 0.4.0)
|
||||
nokogiri
|
||||
arel (6.0.4)
|
||||
autodoc (0.6.0)
|
||||
arel (7.1.4)
|
||||
autodoc (0.7.3)
|
||||
actionpack
|
||||
activesupport (>= 3.0.0)
|
||||
rspec
|
||||
autoprefixer-rails (9.4.8)
|
||||
autoprefixer-rails (9.6.5)
|
||||
execjs
|
||||
axiom-types (0.1.1)
|
||||
descendants_tracker (~> 0.0.4)
|
||||
|
@ -149,13 +149,13 @@ GEM
|
|||
crack (0.4.3)
|
||||
safe_yaml (~> 1.0.0)
|
||||
crass (1.0.5)
|
||||
daemons (1.2.4)
|
||||
daemons (1.3.1)
|
||||
daemons-rails (1.2.1)
|
||||
daemons
|
||||
multi_json (~> 1.0)
|
||||
data_migrate (5.3.2)
|
||||
rails (>= 4.2)
|
||||
database_cleaner (1.6.1)
|
||||
data_migrate (6.0.5)
|
||||
rails (>= 5.0)
|
||||
database_cleaner (1.7.0)
|
||||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
devise (4.7.1)
|
||||
|
@ -171,12 +171,12 @@ GEM
|
|||
equalizer (0.0.11)
|
||||
erubis (2.7.0)
|
||||
execjs (2.7.0)
|
||||
ffi (1.9.25)
|
||||
ffi (1.11.1)
|
||||
figaro (1.1.1)
|
||||
thor (~> 0.14)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
grape (1.2.3)
|
||||
grape (1.2.4)
|
||||
activesupport
|
||||
builder
|
||||
mustermann-grape (~> 1.0.0)
|
||||
|
@ -190,13 +190,14 @@ GEM
|
|||
tilt
|
||||
hashdiff (1.0.0)
|
||||
hpricot (0.8.6)
|
||||
http-accept (1.7.0)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
httpi (2.4.4)
|
||||
rack
|
||||
socksify
|
||||
i18n (0.9.5)
|
||||
i18n (1.7.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n_data (0.8.0)
|
||||
ice_nine (0.11.2)
|
||||
|
@ -229,25 +230,25 @@ GEM
|
|||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
method_source (0.8.2)
|
||||
mime-types (3.1)
|
||||
mime-types (3.3)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0521)
|
||||
mime-types-data (3.2019.1009)
|
||||
mina (0.3.1)
|
||||
open4 (~> 1.3.4)
|
||||
rake
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.10.3)
|
||||
monetize (1.9.0)
|
||||
monetize (1.9.2)
|
||||
money (~> 6.12)
|
||||
money (6.12.0)
|
||||
i18n (>= 0.6.4, < 1.1)
|
||||
money-rails (1.12.0)
|
||||
money (6.13.4)
|
||||
i18n (>= 0.6.4, <= 2)
|
||||
money-rails (1.13.2)
|
||||
activesupport (>= 3.0)
|
||||
monetize (~> 1.9.0)
|
||||
money (~> 6.12.0)
|
||||
money (~> 6.13.2)
|
||||
railties (>= 3.0)
|
||||
multi_json (1.13.1)
|
||||
multi_json (1.14.1)
|
||||
mustermann (1.0.3)
|
||||
mustermann-grape (1.0.0)
|
||||
mustermann (~> 1.0.0)
|
||||
|
@ -276,83 +277,89 @@ GEM
|
|||
erubis
|
||||
que (~> 0.8)
|
||||
sinatra
|
||||
rack (1.6.11)
|
||||
rack (2.0.7)
|
||||
rack-accept (0.4.5)
|
||||
rack (>= 0.4)
|
||||
rack-protection (1.5.5)
|
||||
rack-protection (2.0.7)
|
||||
rack
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
railroady (1.3.0)
|
||||
rails (4.2.11.1)
|
||||
actionmailer (= 4.2.11.1)
|
||||
actionpack (= 4.2.11.1)
|
||||
actionview (= 4.2.11.1)
|
||||
activejob (= 4.2.11.1)
|
||||
activemodel (= 4.2.11.1)
|
||||
activerecord (= 4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.2.11.1)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.9)
|
||||
activesupport (>= 4.2.0, < 5.0)
|
||||
nokogiri (~> 1.6)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails (5.0.7.2)
|
||||
actioncable (= 5.0.7.2)
|
||||
actionmailer (= 5.0.7.2)
|
||||
actionpack (= 5.0.7.2)
|
||||
actionview (= 5.0.7.2)
|
||||
activejob (= 5.0.7.2)
|
||||
activemodel (= 5.0.7.2)
|
||||
activerecord (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.0.7.2)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
rails-settings-cached (0.7.2)
|
||||
rails (>= 4.2.0)
|
||||
railties (4.2.11.1)
|
||||
actionpack (= 4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
railties (5.0.7.2)
|
||||
actionpack (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (12.3.3)
|
||||
rake (13.0.0)
|
||||
ransack (1.8.10)
|
||||
actionpack (>= 3.0, < 5.2)
|
||||
activerecord (>= 3.0, < 5.2)
|
||||
activesupport (>= 3.0, < 5.2)
|
||||
i18n
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.10.0)
|
||||
ffi (~> 1.0)
|
||||
rbtree3 (0.5.0)
|
||||
rdoc (4.3.0)
|
||||
regexp_parser (1.6.0)
|
||||
request_store (1.4.1)
|
||||
rack (>= 1.4)
|
||||
responders (2.4.1)
|
||||
actionpack (>= 4.2.0, < 6.0)
|
||||
railties (>= 4.2.0, < 6.0)
|
||||
rest-client (2.0.1)
|
||||
responders (3.0.0)
|
||||
actionpack (>= 5.0)
|
||||
railties (>= 5.0)
|
||||
rest-client (2.1.0)
|
||||
http-accept (>= 1.7.0, < 2.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rspec (3.6.0)
|
||||
rspec-core (~> 3.6.0)
|
||||
rspec-expectations (~> 3.6.0)
|
||||
rspec-mocks (~> 3.6.0)
|
||||
rspec-core (3.6.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-expectations (3.6.0)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-expectations (3.9.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-mocks (3.6.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-mocks (3.9.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.6.0)
|
||||
rspec-support (3.6.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.0)
|
||||
rubyzip (2.0.0)
|
||||
safe_yaml (1.0.5)
|
||||
sass (3.4.23)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
sass-rails (5.0.6)
|
||||
railties (>= 4.0.0, < 6)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
sassc (2.0.0)
|
||||
ffi (~> 1.9.6)
|
||||
rake
|
||||
sassc (2.2.1)
|
||||
ffi (~> 1.9)
|
||||
savon (2.12.0)
|
||||
akami (~> 1.2)
|
||||
builder (>= 2.1.2)
|
||||
|
@ -376,10 +383,11 @@ GEM
|
|||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
simpleidn (0.0.7)
|
||||
sinatra (1.4.8)
|
||||
rack (~> 1.5)
|
||||
rack-protection (~> 1.4)
|
||||
tilt (>= 1.3, < 3)
|
||||
sinatra (2.0.7)
|
||||
mustermann (~> 1.0)
|
||||
rack (~> 2.0)
|
||||
rack-protection (= 2.0.7)
|
||||
tilt (~> 2.0)
|
||||
sixarm_ruby_unaccent (1.2.0)
|
||||
slop (3.6.0)
|
||||
socksify (1.7.1)
|
||||
|
@ -396,7 +404,7 @@ GEM
|
|||
tilt (2.0.10)
|
||||
tzinfo (1.2.5)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (4.1.11)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
|
@ -409,8 +417,8 @@ GEM
|
|||
coercible (~> 1.0)
|
||||
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||
equalizer (~> 0.0, >= 0.0.9)
|
||||
warden (1.2.7)
|
||||
rack (>= 1.0)
|
||||
warden (1.2.8)
|
||||
rack (>= 2.0.6)
|
||||
wasabi (3.5.0)
|
||||
httpi (~> 2.0)
|
||||
nokogiri (>= 1.4.2)
|
||||
|
@ -422,6 +430,9 @@ GEM
|
|||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff (>= 0.4.0, < 2.0.0)
|
||||
websocket-driver (0.6.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.4)
|
||||
whenever (0.9.4)
|
||||
chronic (>= 0.6.3)
|
||||
wkhtmltopdf-binary (0.12.4)
|
||||
|
@ -432,7 +443,6 @@ PLATFORMS
|
|||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
active_model-errors_details
|
||||
airbrake
|
||||
autodoc
|
||||
bootstrap-sass (~> 3.4)
|
||||
|
@ -472,7 +482,7 @@ DEPENDENCIES
|
|||
que
|
||||
que-web
|
||||
railroady (= 1.3.0)
|
||||
rails (= 4.2.11.1)
|
||||
rails (~> 5.0.7)
|
||||
rails-settings-cached (= 0.7.2)
|
||||
ransack (~> 1.8)
|
||||
rest-client
|
||||
|
|
|
@ -3,6 +3,7 @@ module Admin
|
|||
load_and_authorize_resource
|
||||
before_action :set_contact, only: [:show]
|
||||
helper_method :ident_types
|
||||
helper_method :domain_filter_params
|
||||
|
||||
def index
|
||||
params[:q] ||= {}
|
||||
|
@ -19,7 +20,7 @@ module Admin
|
|||
|
||||
normalize_search_parameters do
|
||||
@q = contacts.search(search_params)
|
||||
@contacts = @q.result.uniq.page(params[:page])
|
||||
@contacts = @q.result.distinct.page(params[:page])
|
||||
end
|
||||
|
||||
@contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||
|
@ -84,5 +85,9 @@ module Admin
|
|||
def ident_types
|
||||
Contact::Ident.types
|
||||
end
|
||||
|
||||
def domain_filter_params
|
||||
params.permit(:domain_filter)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ module Admin
|
|||
end
|
||||
|
||||
def notify_by_email?
|
||||
ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:notify_by_email])
|
||||
ActiveRecord::Type::Boolean.new.cast(params[:notify_by_email])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ module Api
|
|||
|
||||
def cors_preflight_check
|
||||
set_access_control_headers
|
||||
render text: ''
|
||||
render plain: ''
|
||||
end
|
||||
|
||||
def set_access_control_headers
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
require 'rails5_api_controller_backport'
|
||||
|
||||
module Api
|
||||
module V1
|
||||
class BaseController < ActionController::API
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
require 'rails5_api_controller_backport'
|
||||
require 'auth_token/auth_token_creator'
|
||||
|
||||
module Api
|
||||
|
@ -16,7 +15,7 @@ module Api
|
|||
end
|
||||
|
||||
def eid
|
||||
user = RegistrantUser.find_or_create_by_api_data(eid_params)
|
||||
user = RegistrantUser.find_or_create_by_api_data(eid_params.to_h)
|
||||
token = create_token(user)
|
||||
|
||||
if token
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
require 'rails5_api_controller_backport'
|
||||
require 'auth_token/auth_token_decryptor'
|
||||
|
||||
module Api
|
||||
|
|
|
@ -3,7 +3,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
protect_from_forgery with: :exception, prepend: true
|
||||
|
||||
before_action do
|
||||
resource = controller_name.singularize.to_sym
|
||||
|
|
|
@ -3,7 +3,6 @@ module Epp
|
|||
class AuthorizationError < StandardError; end
|
||||
|
||||
check_authorization
|
||||
skip_before_action :verify_authenticity_token
|
||||
layout false
|
||||
|
||||
before_action :ensure_session_id_passed
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Registrant::ContactsController < RegistrantController
|
||||
helper_method :domain
|
||||
helper_method :fax_enabled?
|
||||
helper_method :domain_filter_params
|
||||
skip_authorization_check only: %i[edit update]
|
||||
|
||||
def show
|
||||
|
@ -99,4 +100,8 @@ class Registrant::ContactsController < RegistrantController
|
|||
http.request(request)
|
||||
end
|
||||
end
|
||||
|
||||
def domain_filter_params
|
||||
params.permit(:domain_filter)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@ class Registrar
|
|||
before_action :init_epp_contact
|
||||
helper_method :address_processing?
|
||||
helper_method :ident_types
|
||||
helper_method :domain_filter_params
|
||||
|
||||
def index
|
||||
authorize! :view, Depp::Contact
|
||||
|
@ -68,7 +69,7 @@ class Registrar
|
|||
|
||||
def create
|
||||
authorize! :create, Depp::Contact
|
||||
@contact = Depp::Contact.new(params[:depp_contact])
|
||||
@contact = Depp::Contact.new(contact_params)
|
||||
|
||||
if @contact.save
|
||||
redirect_to registrar_contact_url(@contact.id)
|
||||
|
@ -79,9 +80,9 @@ class Registrar
|
|||
|
||||
def update
|
||||
authorize! :edit, Depp::Contact
|
||||
@contact = Depp::Contact.new(params[:depp_contact])
|
||||
@contact = Depp::Contact.new(contact_params)
|
||||
|
||||
if @contact.update_attributes(params[:depp_contact])
|
||||
if @contact.update_attributes(contact_params)
|
||||
redirect_to registrar_contact_url(@contact.id)
|
||||
else
|
||||
render 'edit'
|
||||
|
@ -95,7 +96,7 @@ class Registrar
|
|||
|
||||
def destroy
|
||||
authorize! :delete, Depp::Contact
|
||||
@contact = Depp::Contact.new(params[:depp_contact])
|
||||
@contact = Depp::Contact.new(contact_params_for_delete)
|
||||
|
||||
if @contact.delete
|
||||
redirect_to registrar_contacts_url, notice: t(:destroyed)
|
||||
|
@ -104,6 +105,12 @@ class Registrar
|
|||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def domain_filter_params
|
||||
params.permit(:domain_filter)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def init_epp_contact
|
||||
|
@ -131,5 +138,22 @@ class Registrar
|
|||
def ident_types
|
||||
Contact::Ident.types
|
||||
end
|
||||
|
||||
def contact_params
|
||||
params.require(:depp_contact).permit(:id,
|
||||
:name,
|
||||
:email,
|
||||
:phone,
|
||||
:org_name,
|
||||
:ident, :ident_type, :ident_country_code,
|
||||
:street, :city, :zip, :state, :country_code,
|
||||
:password,
|
||||
:legal_document,
|
||||
:code)
|
||||
end
|
||||
|
||||
def contact_params_for_delete
|
||||
params.require(:depp_contact).permit(:id, :password, :legal_document)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,16 +2,17 @@ class Registrar
|
|||
class DomainsController < DeppController
|
||||
before_action :init_domain, except: :new
|
||||
helper_method :contacts
|
||||
helper_method :search_params
|
||||
|
||||
def index
|
||||
authorize! :view, Depp::Domain
|
||||
|
||||
params[:q] ||= {}
|
||||
params[:q].delete_if { |_k, v| v.blank? }
|
||||
if params[:q].length == 1 && params[:q][:name_matches].present?
|
||||
@domain = Domain.find_by(name: params[:q][:name_matches])
|
||||
if @domain
|
||||
redirect_to info_registrar_domains_url(domain_name: @domain.name) and return
|
||||
if search_params.to_h.delete_if { |_key, value| value.blank? }.length == 1 &&
|
||||
search_params[:name_matches].present?
|
||||
domain = Domain.find_by(name: search_params[:name_matches])
|
||||
|
||||
if domain
|
||||
redirect_to info_registrar_domains_url(domain_name: domain.name) and return
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -24,15 +25,15 @@ class Registrar
|
|||
end
|
||||
|
||||
normalize_search_parameters do
|
||||
@q = domains.search(params[:q])
|
||||
@q = domains.search(search_params)
|
||||
@domains = @q.result.page(params[:page])
|
||||
if @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/
|
||||
# if we do not get any results, add wildcards to the name field and search again
|
||||
n_cache = params[:q][:name_matches]
|
||||
params[:q][:name_matches] = "%#{params[:q][:name_matches]}%"
|
||||
@q = domains.search(params[:q])
|
||||
|
||||
# if we do not get any results, add wildcards to the name field and search again
|
||||
if @domains.count == 0 && search_params[:name_matches] !~ /^%.+%$/
|
||||
new_search_params = search_params.to_h
|
||||
new_search_params[:name_matches] = "%#{new_search_params[:name_matches]}%"
|
||||
@q = domains.search(new_search_params)
|
||||
@domains = @q.result.page(params[:page])
|
||||
params[:q][:name_matches] = n_cache # we don't want to show wildcards in search form
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -164,17 +165,26 @@ class Registrar
|
|||
end
|
||||
|
||||
def normalize_search_parameters
|
||||
ca_cache = params[:q][:valid_to_lteq]
|
||||
ca_cache = search_params[:valid_to_lteq]
|
||||
begin
|
||||
end_time = params[:q][:valid_to_lteq].try(:to_date)
|
||||
params[:q][:valid_to_lteq] = end_time.try(:end_of_day)
|
||||
end_time = search_params[:valid_to_lteq].try(:to_date)
|
||||
search_params[:valid_to_lteq] = end_time.try(:end_of_day)
|
||||
rescue
|
||||
logger.warn('Invalid date')
|
||||
end
|
||||
|
||||
yield
|
||||
|
||||
params[:q][:valid_to_lteq] = ca_cache
|
||||
search_params[:valid_to_lteq] = ca_cache
|
||||
end
|
||||
|
||||
def search_params
|
||||
params.fetch(:q, {}).permit(:name_matches,
|
||||
:registrant_ident_eq,
|
||||
:contacts_ident_eq,
|
||||
:nameservers_hostname_eq,
|
||||
:valid_to_gteq,
|
||||
:valid_to_lteq)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ class Registrar
|
|||
ip_allowed = restricted_ip.can_access_registrar_area?(resource.registrar)
|
||||
|
||||
unless ip_allowed
|
||||
render text: t('registrar.authorization.ip_not_allowed', ip: request.ip)
|
||||
render plain: t('registrar.authorization.ip_not_allowed', ip: request.ip)
|
||||
warden.logout(:registrar_user)
|
||||
return
|
||||
end
|
||||
|
@ -171,7 +171,7 @@ class Registrar
|
|||
|
||||
return if allowed
|
||||
|
||||
render text: t('registrar.authorization.ip_not_allowed', ip: request.ip)
|
||||
render plain: t('registrar.authorization.ip_not_allowed', ip: request.ip)
|
||||
end
|
||||
|
||||
def current_ability
|
||||
|
|
|
@ -19,7 +19,7 @@ class Registrar
|
|||
xml_dir_path = Rails.root + 'app/views/registrar/xml_consoles/epp_requests'
|
||||
xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml")
|
||||
xml.gsub!('<clTRID>ABC-12345</clTRID>', "<clTRID>#{cl_trid}</clTRID>")
|
||||
render text: xml
|
||||
render plain: xml
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Account < ActiveRecord::Base
|
||||
class Account < ApplicationRecord
|
||||
include Versions
|
||||
|
||||
belongs_to :registrar, required: true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AccountActivity < ActiveRecord::Base
|
||||
class AccountActivity < ApplicationRecord
|
||||
include Versions
|
||||
belongs_to :account, required: true
|
||||
belongs_to :bank_transaction
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Action < ActiveRecord::Base
|
||||
class Action < ApplicationRecord
|
||||
has_paper_trail class_name: 'ActionVersion'
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module ApiLog
|
||||
class Db < ActiveRecord::Base
|
||||
class Db < ApplicationRecord
|
||||
self.abstract_class = true
|
||||
# to_sym is needed because passing a string to ActiveRecord::Base.establish_connection
|
||||
# for a configuration lookup is deprecated
|
||||
|
|
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class Auction < ActiveRecord::Base
|
||||
class Auction < ApplicationRecord
|
||||
enum status: {
|
||||
started: 'started',
|
||||
awaiting_payment: 'awaiting_payment',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class BankStatement < ActiveRecord::Base
|
||||
class BankStatement < ApplicationRecord
|
||||
include Versions
|
||||
has_many :bank_transactions
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class BankTransaction < ActiveRecord::Base
|
||||
class BankTransaction < ApplicationRecord
|
||||
include Versions
|
||||
belongs_to :bank_statement
|
||||
has_one :account_activity
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module Billing
|
||||
class Price < ActiveRecord::Base
|
||||
class Price < ApplicationRecord
|
||||
include Concerns::Billing::Price::Expirable
|
||||
|
||||
belongs_to :zone, class_name: 'DNS::Zone', required: true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class BlockedDomain < ActiveRecord::Base
|
||||
class BlockedDomain < ApplicationRecord
|
||||
include Versions
|
||||
before_save :generate_data
|
||||
after_destroy :remove_data
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'open3'
|
||||
|
||||
class Certificate < ActiveRecord::Base
|
||||
class Certificate < ApplicationRecord
|
||||
include Versions
|
||||
|
||||
belongs_to :api_user
|
||||
|
|
|
@ -35,7 +35,7 @@ module Concerns::Domain::ForceDelete
|
|||
end
|
||||
|
||||
def preserve_current_statuses_for_force_delete
|
||||
self.statuses_before_force_delete = statuses
|
||||
self.statuses_before_force_delete = statuses.clone
|
||||
end
|
||||
|
||||
def restore_statuses_before_force_delete
|
||||
|
|
|
@ -20,7 +20,7 @@ module EppErrors
|
|||
epp_errors << collect_parent_errors(attr, errors)
|
||||
end
|
||||
|
||||
errors[:epp_errors] = epp_errors
|
||||
errors.add(:epp_errors, epp_errors)
|
||||
errors[:epp_errors].flatten!
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Contact < ActiveRecord::Base
|
||||
class Contact < ApplicationRecord
|
||||
include Versions # version/contact_version.rb
|
||||
include EppErrors
|
||||
include UserEvents
|
||||
|
@ -246,10 +246,8 @@ class Contact < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def registrant_user_contacts(registrant_user)
|
||||
# In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can
|
||||
# be removed.
|
||||
from("(#{registrant_user_direct_contacts(registrant_user).to_sql} UNION " \
|
||||
"#{registrant_user_indirect_contacts(registrant_user).to_sql}) AS contacts")
|
||||
registrant_user_direct_contacts(registrant_user)
|
||||
.or(registrant_user_indirect_contacts(registrant_user))
|
||||
end
|
||||
|
||||
def registrant_user_direct_contacts(registrant_user)
|
||||
|
@ -415,7 +413,7 @@ class Contact < ActiveRecord::Base
|
|||
# if total is smaller than needed, the load more
|
||||
# we also need to sort by valid_to
|
||||
# todo: extract to drapper. Then we can remove Domain#roles
|
||||
def all_domains(page: nil, per: nil, params: {})
|
||||
def all_domains(page: nil, per: nil, params:)
|
||||
# compose filter sql
|
||||
filter_sql = case params[:domain_filter]
|
||||
when "Registrant".freeze
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Directo < ActiveRecord::Base
|
||||
class Directo < ApplicationRecord
|
||||
DOMAIN_TO_PRODUCT = {"ee" => "01EE", "com.ee" => "02COM", "pri.ee" => "03PRI", "fie.ee"=>"04FIE", "med.ee" => "05MED"}.freeze
|
||||
belongs_to :item, polymorphic: true
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module DNS
|
||||
class Zone < ActiveRecord::Base
|
||||
class Zone < ApplicationRecord
|
||||
validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true
|
||||
validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true }
|
||||
validates :origin, uniqueness: true
|
||||
|
||||
before_destroy do
|
||||
!used?
|
||||
throw(:abort) if used?
|
||||
end
|
||||
|
||||
def self.generate_zonefiles
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Dnskey < ActiveRecord::Base
|
||||
class Dnskey < ApplicationRecord
|
||||
include Versions # version/dnskey_version.rb
|
||||
include EppErrors
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Domain < ActiveRecord::Base
|
||||
class Domain < ApplicationRecord
|
||||
include UserEvents
|
||||
include Versions # version/domain_version.rb
|
||||
include Concerns::Domain::Expirable
|
||||
|
@ -191,8 +191,6 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def registrant_user_domains(registrant_user)
|
||||
# In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can
|
||||
# be removed.
|
||||
from(
|
||||
"(#{registrant_user_domains_by_registrant(registrant_user).to_sql} UNION " \
|
||||
"#{registrant_user_domains_by_contact(registrant_user).to_sql}) AS domains"
|
||||
|
@ -200,8 +198,6 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def registrant_user_direct_domains(registrant_user)
|
||||
# In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can
|
||||
# be removed.
|
||||
from(
|
||||
"(#{registrant_user_direct_domains_by_registrant(registrant_user).to_sql} UNION " \
|
||||
"#{registrant_user_direct_domains_by_contact(registrant_user).to_sql}) AS domains"
|
||||
|
@ -209,8 +205,6 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def registrant_user_administered_domains(registrant_user)
|
||||
# In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can
|
||||
# be removed.
|
||||
from(
|
||||
"(#{registrant_user_domains_by_registrant(registrant_user).to_sql} UNION " \
|
||||
"#{registrant_user_domains_by_admin_contact(registrant_user).to_sql}) AS domains"
|
||||
|
@ -229,7 +223,7 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
def registrant_user_domains_by_admin_contact(registrant_user)
|
||||
joins(:domain_contacts).where(domain_contacts: { contact_id: registrant_user.contacts,
|
||||
type: [AdminDomainContact] })
|
||||
type: [AdminDomainContact.name] })
|
||||
end
|
||||
|
||||
def registrant_user_direct_domains_by_registrant(registrant_user)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class DomainContact < ActiveRecord::Base
|
||||
class DomainContact < ApplicationRecord
|
||||
# STI: tech_domain_contact
|
||||
# STI: admin_domain_contact
|
||||
include Versions # version/domain_contact_version.rb
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class DomainStatus < ActiveRecord::Base
|
||||
class DomainStatus < ApplicationRecord
|
||||
include Versions # version/domain_status_version.rb
|
||||
include EppErrors
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class DomainTransfer < ActiveRecord::Base
|
||||
class DomainTransfer < ApplicationRecord
|
||||
belongs_to :domain
|
||||
|
||||
belongs_to :old_registrar, class_name: 'Registrar'
|
||||
|
|
|
@ -9,7 +9,7 @@ class Epp::Contact < Contact
|
|||
def manage_permissions
|
||||
return unless update_prohibited? || delete_prohibited?
|
||||
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
||||
false
|
||||
throw(:abort)
|
||||
end
|
||||
|
||||
class << self
|
||||
|
|
|
@ -12,7 +12,7 @@ class Epp::Domain < Domain
|
|||
return unless update_prohibited? || delete_prohibited?
|
||||
stat = (statuses & (DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first
|
||||
add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation))
|
||||
false
|
||||
throw(:abort)
|
||||
end
|
||||
|
||||
after_validation :validate_contacts
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class EppSession < ActiveRecord::Base
|
||||
class EppSession < ApplicationRecord
|
||||
belongs_to :user, required: true
|
||||
|
||||
validates :session_id, uniqueness: true, presence: true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Invoice < ActiveRecord::Base
|
||||
class Invoice < ApplicationRecord
|
||||
include Versions
|
||||
include Concerns::Invoice::Cancellable
|
||||
include Concerns::Invoice::Payable
|
||||
|
@ -47,7 +47,7 @@ class Invoice < ActiveRecord::Base
|
|||
|
||||
errors.add(:base, I18n.t('failed_to_generate_invoice_invoice_number_limit_reached'))
|
||||
logger.error('INVOICE NUMBER LIMIT REACHED, COULD NOT GENERATE INVOICE')
|
||||
false
|
||||
throw(:abort)
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class InvoiceItem < ActiveRecord::Base
|
||||
class InvoiceItem < ApplicationRecord
|
||||
include Versions
|
||||
belongs_to :invoice
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class LegalDocument < ActiveRecord::Base
|
||||
class LegalDocument < ApplicationRecord
|
||||
cattr_accessor :explicitly_write_file
|
||||
include EppErrors
|
||||
MIN_BODY_SIZE = (1.37 * 3.kilobytes).ceil
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Nameserver < ActiveRecord::Base
|
||||
class Nameserver < ApplicationRecord
|
||||
include Versions # version/nameserver_version.rb
|
||||
include EppErrors
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Notification < ActiveRecord::Base
|
||||
class Notification < ApplicationRecord
|
||||
include Versions # version/notification_version.rb
|
||||
|
||||
belongs_to :registrar
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# To be able to remove existing jobs
|
||||
class QueJob < ActiveRecord::Base
|
||||
class QueJob < ApplicationRecord
|
||||
self.primary_key = 'job_id'
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# Used in Registrant portal to collect registrant verifications
|
||||
# Registrant postgres user can access this table directly.
|
||||
class RegistrantVerification < ActiveRecord::Base
|
||||
class RegistrantVerification < ApplicationRecord
|
||||
# actions
|
||||
CONFIRMED = 'confirmed'
|
||||
REJECTED = 'rejected'
|
||||
|
||||
|
||||
# action types
|
||||
DOMAIN_REGISTRANT_CHANGE = 'domain_registrant_change'
|
||||
DOMAIN_DELETE = 'domain_delete'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Registrar < ActiveRecord::Base
|
||||
class Registrar < ApplicationRecord
|
||||
include Versions # version/registrar_version.rb
|
||||
|
||||
has_many :domains, dependent: :restrict_with_error
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ReservedDomain < ActiveRecord::Base
|
||||
class ReservedDomain < ApplicationRecord
|
||||
include Versions # version/reserved_domain_version.rb
|
||||
before_save :fill_empty_passwords
|
||||
before_save :generate_data
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module Type
|
||||
class VATRate < ActiveRecord::Type::Decimal
|
||||
def type_cast_from_database(value)
|
||||
def deserialize(value)
|
||||
super * 100 if value
|
||||
end
|
||||
|
||||
def type_cast_for_database(value)
|
||||
def serialize(value)
|
||||
super / 100.0 if value
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
include Versions # version/user_version.rb
|
||||
|
||||
has_many :actions, dependent: :restrict_with_exception
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class WhiteIp < ActiveRecord::Base
|
||||
class WhiteIp < ApplicationRecord
|
||||
include Versions
|
||||
belongs_to :registrar
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module Whois
|
||||
class Server < ActiveRecord::Base
|
||||
class Server < ApplicationRecord
|
||||
self.abstract_class = true
|
||||
establish_connection :"whois_#{Rails.env}"
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "erb"
|
||||
class WhoisRecord < ActiveRecord::Base
|
||||
class WhoisRecord < ApplicationRecord
|
||||
belongs_to :domain
|
||||
belongs_to :registrar
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params)
|
||||
- domains = contact.all_domains(page: params[:domain_page], per: 20,
|
||||
params: domain_filter_params.to_h)
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
.pull-left
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<% domains = contact.all_domains(page: params[:domain_page], per: 20, params: params) %>
|
||||
<% domains = contact.all_domains(page: params[:domain_page], per: 20,
|
||||
params: domain_filter_params.to_h) %>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
|
@ -50,4 +51,4 @@
|
|||
<div class="panel-footer">
|
||||
<%= paginate domains, param_name: :domain_page %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params)
|
||||
- domains = contact.all_domains(page: params[:domain_page], per: 20,
|
||||
params: domain_filter_params.to_h)
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
.pull-left
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<%= f.label :name, for: nil %>
|
||||
<%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control',
|
||||
<%= f.search_field :name_matches, value: search_params[:name_matches], class: 'form-control',
|
||||
placeholder: t(:name) %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<%= f.label :valid_to_from, for: nil %>
|
||||
<%= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq],
|
||||
<%= f.search_field :valid_to_gteq, value: search_params[:valid_to_gteq],
|
||||
class: 'form-control js-datepicker',
|
||||
placeholder: t(:valid_to_from) %>
|
||||
</div>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<%= f.label :valid_to_until, for: nil %>
|
||||
<%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq],
|
||||
<%= f.search_field :valid_to_lteq, value: search_params[:valid_to_lteq],
|
||||
class: 'form-control js-datepicker',
|
||||
placeholder: t(:valid_to_until) %>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||
require_relative '../config/boot'
|
||||
require 'rails/commands'
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'pathname'
|
|||
require 'fileutils'
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||
|
||||
|
||||
def system!(*args)
|
||||
|
@ -22,7 +22,7 @@ Dir.chdir APP_ROOT do
|
|||
end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! 'bin/rake db:setup'
|
||||
system! 'bin/rails db:setup'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rake log:clear tmp:clear'
|
||||
|
|
29
bin/update
Normal file
29
bin/update
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'pathname'
|
||||
require 'fileutils'
|
||||
include 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
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a way to update your development environment automatically.
|
||||
# Add necessary update steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
puts "\n== Updating database =="
|
||||
system! 'bin/rails db:migrate'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! 'bin/rails restart'
|
||||
end
|
|
@ -1,16 +1,8 @@
|
|||
require File.expand_path('../boot', __FILE__)
|
||||
require_relative 'boot'
|
||||
|
||||
# Pick the frameworks you want:
|
||||
require 'active_model/railtie'
|
||||
require 'active_record/railtie'
|
||||
require 'action_controller/railtie'
|
||||
require 'action_mailer/railtie'
|
||||
require 'action_view/railtie'
|
||||
require 'sprockets/railtie'
|
||||
require 'csv'
|
||||
require 'English'
|
||||
require 'rails/all'
|
||||
# require "rails/test_unit/railtie"
|
||||
require 'English'
|
||||
require 'csv'
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
|
@ -44,21 +36,6 @@ module DomainNameRegistry
|
|||
config.eager_load_paths << config.root.join('lib', 'validators')
|
||||
config.watchable_dirs['lib'] = %i[rb]
|
||||
|
||||
# Add the fonts path
|
||||
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
|
||||
|
||||
# Precompile additional assets
|
||||
config.assets.precompile += %w(*.svg *.eot *.woff *.ttf)
|
||||
config.assets.precompile += %w(admin-manifest.css admin-manifest.js)
|
||||
config.assets.precompile += %w(registrar-manifest.css registrar-manifest.js)
|
||||
config.assets.precompile += %w(registrant-manifest.css registrant-manifest.js)
|
||||
|
||||
# Active Record used to suppresses errors raised within
|
||||
# `after_rollback`/`after_commit` callbacks and only printed them to the logs.
|
||||
# In the next version, these errors will no longer be suppressed.
|
||||
# Instead, the errors will propagate normally just like in other Active Record callbacks.
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
|
||||
config.active_record.schema_format = :sql
|
||||
|
||||
config.generators do |g|
|
||||
|
@ -94,5 +71,13 @@ module DomainNameRegistry
|
|||
|
||||
config.action_view.default_form_builder = 'DefaultFormBuilder'
|
||||
config.secret_key_base = Figaro.env.secret_key_base
|
||||
|
||||
# Using `Rails.application.config.active_record.belongs_to_required_by_default` in
|
||||
# `new_framework_defaults.rb` has no effect in Rails 5.0.x.
|
||||
# https://github.com/rails/rails/issues/23589
|
||||
# https://stackoverflow.com/questions/38850712/rails-5-belongs-to-required-by-default-doesnt-work
|
||||
# Not supported by `paper_trail` gem < 5.0
|
||||
# https://github.com/paper-trail-gem/paper_trail/issues/682
|
||||
config.active_record.belongs_to_required_by_default = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||
|
||||
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||
|
|
9
config/cable.yml
Normal file
9
config/cable.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: async
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: redis://localhost:6379/1
|
|
@ -1,5 +1,5 @@
|
|||
# Load the Rails application.
|
||||
require File.expand_path('../application', __FILE__)
|
||||
require_relative 'application'
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
|
|
|
@ -19,8 +19,7 @@ Rails.application.configure do
|
|||
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
||||
# config.action_dispatch.rack_cache = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this).
|
||||
config.serve_static_files = false
|
||||
config.public_file_server.enabled = false
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = Uglifier.new(harmony: true)
|
||||
|
@ -29,38 +28,37 @@ Rails.application.configure do
|
|||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||
config.assets.compile = false
|
||||
|
||||
# Generate digests for assets URLs.
|
||||
config.assets.digest = true
|
||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
config.assets.version = '1.0'
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Mount Action Cable outside main process or domain
|
||||
# config.action_cable.mount_path = nil
|
||||
# config.action_cable.url = 'wss://example.com/cable'
|
||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# Set to :debug to see everything in the log.
|
||||
config.log_level = :info
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
config.log_level = :debug
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
config.log_tags = [:subdomain, :uuid, :remote_ip]
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
require 'syslog/logger'
|
||||
config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new(ENV['app_name'] || 'registry'))
|
||||
config.log_tags = [:request_id, :subdomain, :remote_ip]
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
# config.assets.precompile += %w( search.js )
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment)
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "domain_name_registry_#{Rails.env}"
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
|
@ -68,22 +66,29 @@ Rails.application.configure do
|
|||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
config.i18n.fallbacks = [I18n.default_locale]
|
||||
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Disable automatic flushing of the log to improve performance.
|
||||
# config.autoflush_log = false
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
require 'syslog/logger'
|
||||
config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new(ENV['app_name'] || 'registry'))
|
||||
|
||||
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||
logger = ActiveSupport::Logger.new(STDOUT)
|
||||
logger.formatter = config.log_formatter
|
||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
end
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
end
|
||||
|
||||
# In off mode, queueing a job will simply insert it into the database -
|
||||
# the current process will make no effort to run it.
|
||||
# In off mode, queueing a job will simply insert it into the database -
|
||||
# the current process will make no effort to run it.
|
||||
# You should use this if you want to use a dedicated process to work tasks
|
||||
Que.mode = :off
|
||||
Que.mode = :off
|
||||
|
|
|
@ -1,24 +1,36 @@
|
|||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
# and recreated between test runs. Don't rely on the data there!
|
||||
config.cache_classes = true
|
||||
config.eager_load = false
|
||||
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = 'public, max-age=3600'
|
||||
# Do not eager load code on boot. This avoids loading your whole application
|
||||
# just for the purpose of running a single test. If you are using a tool that
|
||||
# preloads Rails for running tests, you may have to set it to true.
|
||||
config.eager_load = false
|
||||
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Raise exceptions instead of rendering exception templates.
|
||||
config.action_dispatch.show_exceptions = false
|
||||
|
||||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
config.active_support.test_order = :random
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
config.logger = ActiveSupport::Logger.new(nil)
|
||||
|
||||
# Raises error for missing translations
|
||||
config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# If set to :null_store, Setting.x returns nil after first spec runs (database is emptied)
|
||||
|
|
8
config/initializers/application_controller_renderer.rb
Normal file
8
config/initializers/application_controller_renderer.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ActiveSupport::Reloader.to_prepare do
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
||||
# end
|
|
@ -1 +1,17 @@
|
|||
Rails.application.config.assets.precompile += %w( login.css registrar-manifest.css shared/pdf.css )
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.configure do
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
config.assets.version = '1.0'
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
config.assets.precompile += %w[login.css registrar-manifest.css shared/pdf.css]
|
||||
config.assets.precompile += %w(*.svg *.eot *.woff *.ttf)
|
||||
config.assets.precompile += %w(admin-manifest.css admin-manifest.js)
|
||||
config.assets.precompile += %w(registrar-manifest.css registrar-manifest.js)
|
||||
config.assets.precompile += %w(registrant-manifest.css registrant-manifest.js)
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
# Valid options are :json, :marshal, and :hybrid.
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||
|
|
25
config/initializers/new_framework_defaults.rb
Normal file
25
config/initializers/new_framework_defaults.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 5.0 upgrade.
|
||||
#
|
||||
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
|
||||
Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
|
||||
|
||||
# Enable per-form CSRF tokens. Previous versions had false.
|
||||
Rails.application.config.action_controller.per_form_csrf_tokens = true
|
||||
|
||||
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
||||
Rails.application.config.action_controller.forgery_protection_origin_check = true
|
||||
|
||||
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
||||
# Previous versions had false.
|
||||
ActiveSupport.to_time_preserves_timezone = true
|
||||
|
||||
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
||||
ActiveSupport.halt_callback_chains_on_return_false = false
|
||||
|
||||
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
||||
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
||||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
# ActiveSupport.on_load(:active_record) do
|
||||
# self.include_root_in_json = true
|
||||
# self.include_root_in_json = true
|
||||
# end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers: a minimum and maximum.
|
||||
# The `threads` method setting takes two numbers a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||
# and maximum; this matches the default thread size of Active Record.
|
||||
# and maximum, this matches the default thread size of Active Record.
|
||||
#
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
|
||||
threads threads_count, threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
|
||||
#
|
||||
port ENV.fetch("PORT") { 3000 }
|
||||
|
||||
|
@ -32,25 +32,16 @@ environment ENV.fetch("RAILS_ENV") { "development" }
|
|||
#
|
||||
# preload_app!
|
||||
|
||||
# If you are preloading your application and using Active Record, it's
|
||||
# recommended that you close any connections to the database before workers
|
||||
# are forked to prevent connection leakage.
|
||||
#
|
||||
# before_fork do
|
||||
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
|
||||
# end
|
||||
|
||||
# The code in the `on_worker_boot` will be called if you are using
|
||||
# clustered mode by specifying a number of `workers`. After each worker
|
||||
# process is booted, this block will be run. If you are using the `preload_app!`
|
||||
# option, you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, as Ruby
|
||||
# process is booted this block will be run, if you are using `preload_app!`
|
||||
# option you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, Ruby
|
||||
# cannot share connections between processes.
|
||||
#
|
||||
# on_worker_boot do
|
||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||
# end
|
||||
#
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
plugin :tmp_restart
|
||||
|
|
22
config/secrets.yml
Normal file
22
config/secrets.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
# You can use `rails secret` to generate a secure secret key.
|
||||
|
||||
# Make sure the secrets in this file are kept private
|
||||
# if you're sharing your code publicly.
|
||||
|
||||
development:
|
||||
secret_key_base: d876b4cf172fe17628b4486b302e1d805109f4dfbf25aa8f2d89e6cf821dfdc94f4c753e4fdbaa0b6647ba687058266661632b2cd3975c41fb21dbc588b38c92
|
||||
|
||||
test:
|
||||
secret_key_base: 69ecc590b3de231130e3fb390df48a4eb9259722754ef5df6a9e9ab78d69149d8c16ec2d79791c5ba7a89ad7c5afaa8cec1aa794e9a6f986d3c7319a08d6bce2
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
1216
db/structure.sql
1216
db/structure.sql
File diff suppressed because it is too large
Load diff
|
@ -1,149 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "action_view"
|
||||
require "action_controller"
|
||||
require "action_controller/log_subscriber"
|
||||
|
||||
module ActionController
|
||||
# API Controller is a lightweight version of <tt>ActionController::Base</tt>,
|
||||
# created for applications that don't require all functionalities that a complete
|
||||
# \Rails controller provides, allowing you to create controllers with just the
|
||||
# features that you need for API only applications.
|
||||
#
|
||||
# An API Controller is different from a normal controller in the sense that
|
||||
# by default it doesn't include a number of features that are usually required
|
||||
# by browser access only: layouts and templates rendering, cookies, sessions,
|
||||
# flash, assets, and so on. This makes the entire controller stack thinner,
|
||||
# suitable for API applications. It doesn't mean you won't have such
|
||||
# features if you need them: they're all available for you to include in
|
||||
# your application, they're just not part of the default API controller stack.
|
||||
#
|
||||
# Normally, +ApplicationController+ is the only controller that inherits from
|
||||
# <tt>ActionController::API</tt>. All other controllers in turn inherit from
|
||||
# +ApplicationController+.
|
||||
#
|
||||
# A sample controller could look like this:
|
||||
#
|
||||
# class PostsController < ApplicationController
|
||||
# def index
|
||||
# posts = Post.all
|
||||
# render json: posts
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# Request, response, and parameters objects all work the exact same way as
|
||||
# <tt>ActionController::Base</tt>.
|
||||
#
|
||||
# == Renders
|
||||
#
|
||||
# The default API Controller stack includes all renderers, which means you
|
||||
# can use <tt>render :json</tt> and brothers freely in your controllers. Keep
|
||||
# in mind that templates are not going to be rendered, so you need to ensure
|
||||
# your controller is calling either <tt>render</tt> or <tt>redirect_to</tt> in
|
||||
# all actions, otherwise it will return 204 No Content.
|
||||
#
|
||||
# def show
|
||||
# post = Post.find(params[:id])
|
||||
# render json: post
|
||||
# end
|
||||
#
|
||||
# == Redirects
|
||||
#
|
||||
# Redirects are used to move from one action to another. You can use the
|
||||
# <tt>redirect_to</tt> method in your controllers in the same way as in
|
||||
# <tt>ActionController::Base</tt>. For example:
|
||||
#
|
||||
# def create
|
||||
# redirect_to root_url and return if not_authorized?
|
||||
# # do stuff here
|
||||
# end
|
||||
#
|
||||
# == Adding New Behavior
|
||||
#
|
||||
# In some scenarios you may want to add back some functionality provided by
|
||||
# <tt>ActionController::Base</tt> that is not present by default in
|
||||
# <tt>ActionController::API</tt>, for instance <tt>MimeResponds</tt>. This
|
||||
# module gives you the <tt>respond_to</tt> method. Adding it is quite simple,
|
||||
# you just need to include the module in a specific controller or in
|
||||
# +ApplicationController+ in case you want it available in your entire
|
||||
# application:
|
||||
#
|
||||
# class ApplicationController < ActionController::API
|
||||
# include ActionController::MimeResponds
|
||||
# end
|
||||
#
|
||||
# class PostsController < ApplicationController
|
||||
# def index
|
||||
# posts = Post.all
|
||||
#
|
||||
# respond_to do |format|
|
||||
# format.json { render json: posts }
|
||||
# format.xml { render xml: posts }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# Make sure to check the modules included in <tt>ActionController::Base</tt>
|
||||
# if you want to use any other functionality that is not provided
|
||||
# by <tt>ActionController::API</tt> out of the box.
|
||||
class API < Metal
|
||||
abstract!
|
||||
|
||||
# Shortcut helper that returns all the ActionController::API modules except
|
||||
# the ones passed as arguments:
|
||||
#
|
||||
# class MyAPIBaseController < ActionController::Metal
|
||||
# ActionController::API.without_modules(:ForceSSL, :UrlFor).each do |left|
|
||||
# include left
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# This gives better control over what you want to exclude and makes it easier
|
||||
# to create an API controller class, instead of listing the modules required
|
||||
# manually.
|
||||
def self.without_modules(*modules)
|
||||
modules = modules.map do |m|
|
||||
m.is_a?(Symbol) ? ActionController.const_get(m) : m
|
||||
end
|
||||
|
||||
MODULES - modules
|
||||
end
|
||||
|
||||
MODULES = [
|
||||
AbstractController::Rendering,
|
||||
|
||||
UrlFor,
|
||||
Redirecting,
|
||||
ApiRendering,
|
||||
Renderers::All,
|
||||
ConditionalGet,
|
||||
BasicImplicitRender,
|
||||
StrongParameters,
|
||||
|
||||
ForceSSL,
|
||||
DataStreaming,
|
||||
|
||||
# Before callbacks should also be executed as early as possible, so
|
||||
# also include them at the bottom.
|
||||
AbstractController::Callbacks,
|
||||
|
||||
# Append rescue at the bottom to wrap as much as possible.
|
||||
Rescue,
|
||||
|
||||
# Add instrumentations hooks at the bottom, to ensure they instrument
|
||||
# all the methods properly.
|
||||
Instrumentation,
|
||||
|
||||
# Params wrapper should come before instrumentation so they are
|
||||
# properly showed in logs
|
||||
ParamsWrapper
|
||||
]
|
||||
|
||||
MODULES.each do |mod|
|
||||
include mod
|
||||
end
|
||||
|
||||
ActiveSupport.run_load_hooks(:action_controller_api, self)
|
||||
ActiveSupport.run_load_hooks(:action_controller, self)
|
||||
end
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionController
|
||||
module ApiRendering
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
include Rendering
|
||||
end
|
||||
|
||||
def render_to_body(options = {})
|
||||
_process_options(options)
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionController
|
||||
module BasicImplicitRender # :nodoc:
|
||||
def send_action(method, *args)
|
||||
super.tap { default_render unless performed? }
|
||||
end
|
||||
|
||||
def default_render(*args)
|
||||
head :no_content
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
require_relative 'action_controller/metal/basic_implicit_render'
|
||||
require_relative 'action_controller/api/api_rendering'
|
||||
require_relative 'action_controller/api'
|
|
@ -17,7 +17,7 @@ class ApplicationSystemTestCase < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase
|
||||
self.use_transactional_fixtures = false
|
||||
self.use_transactional_tests = false
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
|
||||
Capybara.register_driver(:chrome) do |app|
|
||||
|
|
|
@ -12,7 +12,7 @@ class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest
|
|||
new_iban = 'GB94BARC10201530093459'
|
||||
assert_not_equal new_iban, @registrar.iban
|
||||
|
||||
patch admin_registrar_path(@registrar), registrar: { iban: new_iban }
|
||||
patch admin_registrar_path(@registrar), params: { registrar: { iban: new_iban } }
|
||||
@registrar.reload
|
||||
|
||||
assert_equal new_iban, @registrar.iban
|
||||
|
|
|
@ -10,7 +10,7 @@ class AdminAreaZonesIntegrationTest < ApplicationIntegrationTest
|
|||
new_master_nameserver = 'new.test'
|
||||
assert_not_equal new_master_nameserver, @zone.master_nameserver
|
||||
|
||||
patch admin_zone_path(@zone), zone: { master_nameserver: new_master_nameserver }
|
||||
patch admin_zone_path(@zone), params: { zone: { master_nameserver: new_master_nameserver } }
|
||||
@zone.reload
|
||||
|
||||
assert_equal new_master_nameserver, @zone.master_nameserver
|
||||
|
|
|
@ -2,9 +2,9 @@ require 'test_helper'
|
|||
|
||||
class APIDomainContactsTest < ApplicationIntegrationTest
|
||||
def test_replace_all_tech_contacts_of_the_current_registrar
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_nil domains(:shop).tech_contacts.find_by(code: 'william-001')
|
||||
assert domains(:shop).tech_contacts.find_by(code: 'john-001')
|
||||
|
@ -14,17 +14,17 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
def test_skip_discarded_domains
|
||||
domains(:airport).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:airport).tech_contacts.find_by(code: 'william-001')
|
||||
end
|
||||
|
||||
def test_return_affected_domains_in_alphabetical_order
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ affected_domains: %w[airport.test shop.test],
|
||||
|
@ -36,9 +36,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
domains(:shop).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
domains(:airport).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal %w[airport.test shop.test], JSON.parse(response.body,
|
||||
|
@ -46,25 +46,25 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_keep_other_tech_contacts_intact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:shop).tech_contacts.find_by(code: 'acme-ltd-001')
|
||||
end
|
||||
|
||||
def test_keep_admin_contacts_intact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:airport).admin_contacts.find_by(code: 'william-001')
|
||||
end
|
||||
|
||||
def test_restrict_contacts_to_the_current_registrar
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'jack-001',
|
||||
new_contact_id: 'william-002' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'jack-001',
|
||||
new_contact_id: 'william-002' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
|
@ -74,9 +74,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_non_existent_current_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'non-existent',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'non-existent',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'current_contact_id',
|
||||
|
@ -85,9 +85,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_non_existent_new_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'non-existent' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'non-existent' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'new_contact_id',
|
||||
|
@ -96,9 +96,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_disallow_invalid_new_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'invalid' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'invalid' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'new_contact_id',
|
||||
|
@ -107,9 +107,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_disallow_self_replacement
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'william-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'william-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
message: 'New contact ID must be different from current contact ID' } }),
|
||||
|
|
|
@ -13,7 +13,8 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_domain_transfers
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response 200
|
||||
assert_equal ({ data: [{
|
||||
type: 'domain_transfer',
|
||||
|
@ -26,17 +27,20 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
|
||||
def test_creates_new_domain_transfer
|
||||
assert_difference -> { @domain.transfers.size } do
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
end
|
||||
end
|
||||
|
||||
def test_approves_automatically_if_auto_approval_is_enabled
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert @domain.transfers.last.approved?
|
||||
end
|
||||
|
||||
def test_assigns_new_registrar
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
@domain.reload
|
||||
assert_equal @new_registrar, @domain.registrar
|
||||
end
|
||||
|
@ -44,7 +48,8 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
def test_regenerates_transfer_code
|
||||
@old_transfer_code = @domain.transfer_code
|
||||
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
@domain.reload
|
||||
refute_equal @domain.transfer_code, @old_transfer_code
|
||||
end
|
||||
|
@ -53,34 +58,41 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
@old_registrar = @domain.registrar
|
||||
|
||||
assert_difference -> { @old_registrar.notifications.count } do
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
end
|
||||
end
|
||||
|
||||
def test_duplicates_registrant_admin_and_tech_contacts
|
||||
assert_difference -> { @new_registrar.contacts.size }, 3 do
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
end
|
||||
end
|
||||
|
||||
def test_reuses_identical_contact
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_equal 1, @new_registrar.contacts.where(name: 'William').size
|
||||
end
|
||||
|
||||
def test_fails_if_domain_does_not_exist
|
||||
request_params = { format: :json,
|
||||
data: { domainTransfers: [{ domainName: 'non-existent.test', transferCode: 'any' }] } }
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers',
|
||||
params: { data: { domainTransfers: [{ domainName: 'non-existent.test',
|
||||
transferCode: 'any' }] } },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response 400
|
||||
assert_equal ({ errors: [{ title: 'non-existent.test does not exist' }] }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_fails_if_transfer_code_is_wrong
|
||||
request_params = { format: :json,
|
||||
data: { domainTransfers: [{ domainName: 'shop.test', transferCode: 'wrong' }] } }
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers',
|
||||
params: { data: { domainTransfers: [{ domainName: 'shop.test',
|
||||
transferCode: 'wrong' }] } },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response 400
|
||||
refute_equal @new_registrar, @domain.registrar
|
||||
assert_equal ({ errors: [{ title: 'shop.test transfer code is wrong' }] }),
|
||||
|
@ -90,8 +102,7 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
private
|
||||
|
||||
def request_params
|
||||
{ format: :json,
|
||||
data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
|
||||
{ data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
|
||||
end
|
||||
|
||||
def http_auth_key
|
||||
|
|
|
@ -5,18 +5,23 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
|||
old_nameserver_ids = [nameservers(:shop_ns1).id,
|
||||
nameservers(:airport_ns1).id,
|
||||
nameservers(:metro_ns1).id]
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_empty (old_nameserver_ids & registrars(:bestnames).nameservers(true).ids)
|
||||
params = { data: { type: 'nameserver',
|
||||
id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_empty (old_nameserver_ids & registrars(:bestnames).nameservers.reload.ids)
|
||||
end
|
||||
|
||||
def test_saves_all_attributes
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] } } }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
new_nameserver = domains(:shop).nameservers.find_by(hostname: 'ns55.bestnames.test')
|
||||
assert_equal ['192.0.2.55'], new_nameserver.ipv4
|
||||
|
@ -24,52 +29,60 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_keeps_other_nameserver_intact
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
|
||||
other_nameserver_hash = nameservers(:shop_ns2).attributes
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_equal other_nameserver_hash, nameservers(:shop_ns2).reload.attributes
|
||||
end
|
||||
|
||||
def test_keeps_other_registrar_nameservers_intact
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
|
||||
nameserver_hash = nameservers(:metro_ns1).attributes
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_equal nameserver_hash, nameservers(:metro_ns1).reload.attributes
|
||||
end
|
||||
|
||||
def test_returns_new_nameserver_record_and_affected_domain
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] } } }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] } } }
|
||||
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response 200
|
||||
assert_equal ({ data: { type: 'nameserver',
|
||||
id: 'ns55.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] }},
|
||||
ipv6: ['2001:db8::55'] } },
|
||||
affected_domains: ["airport.test", "shop.test"] }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_optional_params
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response 200
|
||||
end
|
||||
|
||||
def test_non_existent_nameserver_hostname
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'non-existent.test',
|
||||
attributes: { hostname: 'any.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
params = { data: { type: 'nameserver', id: 'non-existent.test',
|
||||
attributes: { hostname: 'any.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response 404
|
||||
assert_equal ({ errors: [{ title: 'Hostname non-existent.test does not exist' }] }),
|
||||
|
@ -77,9 +90,10 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_invalid_request_params
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: '' } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: '' } } }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response 400
|
||||
assert_equal ({ errors: [{ title: 'Hostname is missing' }] }),
|
||||
|
|
|
@ -20,7 +20,7 @@ class RegistrantApiAuthenticationTest < ApplicationIntegrationTest
|
|||
last_name: 'Smith',
|
||||
}
|
||||
|
||||
post '/api/v1/registrant/auth/eid', params
|
||||
post '/api/v1/registrant/auth/eid', params: params
|
||||
assert(User.find_by(registrant_ident: 'EE-30110100103'))
|
||||
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -29,7 +29,7 @@ class RegistrantApiAuthenticationTest < ApplicationIntegrationTest
|
|||
|
||||
def test_request_returns_existing_user
|
||||
assert_no_changes User.count do
|
||||
post '/api/v1/registrant/auth/eid', @user_hash
|
||||
post '/api/v1/registrant/auth/eid', params: @user_hash
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,7 +38,7 @@ class RegistrantApiAuthenticationTest < ApplicationIntegrationTest
|
|||
@original_whitelist_ip = ENV['registrant_api_auth_allowed_ips']
|
||||
ENV['registrant_api_auth_allowed_ips'] = '1.2.3.4'
|
||||
|
||||
post '/api/v1/registrant/auth/eid', params
|
||||
post '/api/v1/registrant/auth/eid', params: params
|
||||
assert_equal(401, response.status)
|
||||
json_body = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
@ -50,7 +50,7 @@ class RegistrantApiAuthenticationTest < ApplicationIntegrationTest
|
|||
def test_request_documented_parameters_are_required
|
||||
params = { foo: :bar, test: :test }
|
||||
|
||||
post '/api/v1/registrant/auth/eid', params
|
||||
post '/api/v1/registrant/auth/eid', params: params
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal({ errors: [{ ident: ['parameter is required'] }] }, json)
|
||||
assert_equal(422, response.status)
|
||||
|
|
|
@ -14,18 +14,19 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
|
|||
contacts(:william).update!(ident: '1234', ident_type: 'priv', ident_country_code: 'US')
|
||||
assert_equal 3, @user.contacts.size
|
||||
|
||||
get '/api/v1/registrant/contacts', { 'limit' => 1, 'offset' => 0 }, @auth_headers
|
||||
get '/api/v1/registrant/contacts', params: { 'limit' => 1, 'offset' => 0 },
|
||||
headers: @auth_headers
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(200, response.status)
|
||||
assert_equal(1, response_json.count)
|
||||
|
||||
get '/api/v1/registrant/contacts', {}, @auth_headers
|
||||
get '/api/v1/registrant/contacts', headers: @auth_headers
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(3, response_json.count)
|
||||
end
|
||||
|
||||
def test_get_contact_details_by_uuid
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, @auth_headers
|
||||
get api_v1_registrant_contact_path(@contact.uuid), headers: @auth_headers
|
||||
|
||||
assert_response :ok
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -33,21 +34,23 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_does_not_accept_limit_higher_than_200
|
||||
get '/api/v1/registrant/contacts', { 'limit' => 400, 'offset' => 0 }, @auth_headers
|
||||
get '/api/v1/registrant/contacts', params: { 'limit' => 400, 'offset' => 0 },
|
||||
headers: @auth_headers
|
||||
assert_equal(400, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal({ errors: [{ limit: ['parameter is out of range'] }] }, response_json)
|
||||
end
|
||||
|
||||
def test_root_does_not_accept_offset_lower_than_0
|
||||
get '/api/v1/registrant/contacts', { 'limit' => 200, 'offset' => "-10" }, @auth_headers
|
||||
get '/api/v1/registrant/contacts', params: { 'limit' => 200, 'offset' => "-10" },
|
||||
headers: @auth_headers
|
||||
assert_equal(400, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal({ errors: [{ offset: ['parameter is out of range'] }] }, response_json)
|
||||
end
|
||||
|
||||
def test_root_returns_401_without_authorization
|
||||
get '/api/v1/registrant/contacts', {}, {}
|
||||
get '/api/v1/registrant/contacts'
|
||||
assert_equal(401, response.status)
|
||||
json_body = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ require 'test_helper'
|
|||
|
||||
class RegistrantApiCorsHeadersTest < ApplicationIntegrationTest
|
||||
def test_returns_200_response_code_for_options_request
|
||||
options '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' }
|
||||
|
||||
process :options, api_v1_registrant_auth_eid_path,
|
||||
headers: { 'Origin' => 'https://example.com' }
|
||||
assert_equal('200', response.code)
|
||||
end
|
||||
|
||||
def test_returns_expected_headers_for_options_requests
|
||||
options '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' }
|
||||
process :options, api_v1_registrant_auth_eid_path, headers: { 'Origin' => 'https://example.com' }
|
||||
|
||||
assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin'])
|
||||
assert_equal('POST, GET, PUT, PATCH, DELETE, OPTIONS',
|
||||
|
@ -20,16 +20,15 @@ class RegistrantApiCorsHeadersTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_empty_body
|
||||
options '/api/v1/registrant/auth/eid', { 'Origin' => 'https://example.com' }
|
||||
|
||||
process :options, api_v1_registrant_auth_eid_path, headers: { 'Origin' => 'https://example.com' }
|
||||
assert_equal('', response.body)
|
||||
end
|
||||
|
||||
def test_it_returns_cors_headers_for_other_requests
|
||||
post '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' }
|
||||
post '/api/v1/registrant/auth/eid', headers: { 'Origin' => 'https://example.com' }
|
||||
assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin'])
|
||||
|
||||
get '/api/v1/registrant/contacts', {}, { 'Origin' => 'https://example.com' }
|
||||
get '/api/v1/registrant/contacts', headers: { 'Origin' => 'https://example.com' }
|
||||
assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin'])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_get_domain_details_by_uuid
|
||||
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', {}, @auth_headers
|
||||
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', headers: @auth_headers
|
||||
assert_equal(200, response.status)
|
||||
|
||||
domain = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -30,7 +30,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_get_non_existent_domain_details_by_uuid
|
||||
get '/api/v1/registrant/domains/random-uuid', {}, @auth_headers
|
||||
get '/api/v1/registrant/domains/random-uuid', headers: @auth_headers
|
||||
assert_equal(404, response.status)
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -38,7 +38,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_returns_domain_list
|
||||
get '/api/v1/registrant/domains', {}, @auth_headers
|
||||
get '/api/v1/registrant/domains', headers: @auth_headers
|
||||
assert_equal(200, response.status)
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -50,20 +50,22 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_accepts_limit_and_offset_parameters
|
||||
get '/api/v1/registrant/domains', { 'limit' => 2, 'offset' => 0 }, @auth_headers
|
||||
get '/api/v1/registrant/domains', params: { 'limit' => 2, 'offset' => 0 },
|
||||
headers: @auth_headers
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_equal(200, response.status)
|
||||
assert_equal(2, response_json.count)
|
||||
|
||||
get '/api/v1/registrant/domains', {}, @auth_headers
|
||||
get '/api/v1/registrant/domains', headers: @auth_headers
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_equal(4, response_json.count)
|
||||
end
|
||||
|
||||
def test_root_does_not_accept_limit_higher_than_200
|
||||
get '/api/v1/registrant/domains', { 'limit' => 400, 'offset' => 0 }, @auth_headers
|
||||
get '/api/v1/registrant/domains', params: { 'limit' => 400, 'offset' => 0 },
|
||||
headers: @auth_headers
|
||||
|
||||
assert_equal(400, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -71,7 +73,8 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_does_not_accept_offset_lower_than_0
|
||||
get '/api/v1/registrant/domains', { 'limit' => 200, 'offset' => "-10" }, @auth_headers
|
||||
get '/api/v1/registrant/domains', params: { 'limit' => 200, 'offset' => "-10" },
|
||||
headers: @auth_headers
|
||||
|
||||
assert_equal(400, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -79,7 +82,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_returns_401_without_authorization
|
||||
get '/api/v1/registrant/domains', {}, {}
|
||||
get '/api/v1/registrant/domains'
|
||||
assert_equal(401, response.status)
|
||||
json_body = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
@ -87,7 +90,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_details_returns_401_without_authorization
|
||||
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', {}, {}
|
||||
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37'
|
||||
assert_equal(401, response.status)
|
||||
json_body = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
|
||||
def test_can_lock_a_not_locked_domain
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
@ -27,7 +27,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
def test_locking_a_domain_creates_a_version_record
|
||||
assert_difference '@domain.versions.count', 1 do
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
end
|
||||
|
||||
@domain.reload
|
||||
|
@ -39,7 +39,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
@domain.save
|
||||
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(422, response.status)
|
||||
|
@ -51,7 +51,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
assert(@domain.locked_by_registrant?)
|
||||
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(422, response.status)
|
||||
|
@ -62,7 +62,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
@domain.apply_registry_lock
|
||||
|
||||
delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert(response_json[:statuses].include?(DomainStatus::OK))
|
||||
|
@ -73,7 +73,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
|
||||
def test_cannot_unlock_a_not_locked_domain
|
||||
delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(422, response.status)
|
||||
|
@ -81,8 +81,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_404_when_domain_is_not_found
|
||||
post '/api/v1/registrant/domains/random-uuid/registry_lock',
|
||||
{}, @auth_headers
|
||||
post '/api/v1/registrant/domains/random-uuid/registry_lock', headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(404, response.status)
|
||||
|
@ -99,7 +98,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
assert_equal '1234', contact.ident
|
||||
assert_equal 'US', contact.ident_country_code
|
||||
|
||||
post api_v1_registrant_domain_registry_lock_path(domain.uuid), nil, @auth_headers
|
||||
post api_v1_registrant_domain_registry_lock_path(domain.uuid), headers: @auth_headers
|
||||
|
||||
assert_response :unauthorized
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -109,7 +108,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
|
||||
def test_registrant_can_lock_a_domain
|
||||
post '/api/v1/registrant/domains/1b3ee442-e8fe-4922-9492-8fcb9dccc69c/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
assert_equal(200, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -125,7 +124,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
assert_equal 'https://bestnames.test', @domain.registrar.website
|
||||
|
||||
post '/api/v1/registrant/domains/1b3ee442-e8fe-4922-9492-8fcb9dccc69c/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
assert_equal(200, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
|
|
@ -15,18 +15,18 @@ class ApiV1AuctionDetailsTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'auction.test', @auction.domain
|
||||
assert_equal Auction.statuses[:no_bids], @auction.status
|
||||
|
||||
get api_v1_auction_path(@auction.uuid), nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_auction_path(@auction.uuid), as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
||||
'domain' => 'auction.test',
|
||||
'status' => Auction.statuses[:no_bids] }), ActiveSupport::JSON
|
||||
.decode(response.body)
|
||||
.decode(response.body)
|
||||
end
|
||||
|
||||
def test_auction_not_found
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
get api_v1_auction_path('non-existing-uuid'), nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_auction_path('non-existing-uuid'), as: :json
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,19 +10,19 @@ class ApiV1AuctionListTest < ActionDispatch::IntegrationTest
|
|||
domain: 'auction.test',
|
||||
status: Auction.statuses[:started])
|
||||
|
||||
get api_v1_auctions_path, nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_auctions_path, as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ([{ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
||||
'domain' => 'auction.test',
|
||||
'status' => Auction.statuses[:started] }]), ActiveSupport::JSON
|
||||
.decode(response.body)
|
||||
.decode(response.body)
|
||||
end
|
||||
|
||||
def test_does_not_return_finished_auctions
|
||||
@auction.update!(domain: 'auction.test', status: Auction.statuses[:awaiting_payment])
|
||||
|
||||
get api_v1_auctions_path, nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_auctions_path, as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_empty ActiveSupport::JSON.decode(response.body)
|
||||
|
|
|
@ -20,47 +20,53 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal '1b3ee442-e8fe-4922-9492-8fcb9dccc69c', @auction.uuid
|
||||
assert_equal 'auction.test', @auction.domain
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:awaiting_payment] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:awaiting_payment] },
|
||||
as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
||||
'domain' => 'auction.test',
|
||||
'status' => Auction.statuses[:awaiting_payment] }), ActiveSupport::JSON
|
||||
.decode(response.body)
|
||||
.decode(response.body)
|
||||
end
|
||||
|
||||
def test_marks_as_awaiting_payment
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:awaiting_payment] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:awaiting_payment] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.awaiting_payment?
|
||||
end
|
||||
|
||||
def test_marks_as_no_bids
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:no_bids] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:no_bids] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.no_bids?
|
||||
end
|
||||
|
||||
def test_marks_as_payment_received
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_received] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.payment_received?
|
||||
end
|
||||
|
||||
def test_marks_as_payment_not_received
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_not_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_not_received] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.payment_not_received?
|
||||
end
|
||||
|
||||
def test_marks_as_domain_not_registered
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:domain_not_registered] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:domain_not_registered] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.domain_not_registered?
|
||||
end
|
||||
|
@ -69,8 +75,9 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
@auction.update!(registration_code: 'auction-001',
|
||||
status: Auction.statuses[:awaiting_payment])
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_received] },
|
||||
as: :json
|
||||
|
||||
response_json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_not_nil response_json['registration_code']
|
||||
|
@ -79,8 +86,9 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_conceals_registration_code_when_payment_is_not_received
|
||||
@auction.update!(status: Auction.statuses[:awaiting_payment])
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_not_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_not_received] },
|
||||
as: :json
|
||||
|
||||
response_json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_nil response_json['registration_code']
|
||||
|
@ -91,8 +99,9 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'auction.test', @auction.domain
|
||||
@whois_record.update!(updated_at: '2010-07-04')
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_received] },
|
||||
as: :json
|
||||
@whois_record.reload
|
||||
|
||||
assert_equal Time.zone.parse('2010-07-05 10:00'), @whois_record.updated_at
|
||||
|
@ -103,8 +112,9 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'auction.test', @auction.domain
|
||||
@whois_record.delete
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_received] },
|
||||
as: :json
|
||||
|
||||
new_whois_record = Whois::Record.find_by(name: @auction.domain)
|
||||
assert_equal Time.zone.parse('2010-07-05 10:00'), new_whois_record.updated_at
|
||||
|
@ -114,16 +124,16 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_inaccessible_when_ip_address_is_not_allowed
|
||||
ENV['auction_api_allowed_ips'] = ''
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: 'any' }.to_json,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid), params: { status: 'any' }, as: :json
|
||||
|
||||
assert_response :unauthorized
|
||||
end
|
||||
|
||||
def test_auction_not_found
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
patch api_v1_auction_path('non-existing-uuid'), { status: Auction.statuses[:no_bids] }.to_json,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path('non-existing-uuid'),
|
||||
params: { status: Auction.statuses[:no_bids] },
|
||||
as: :json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,8 +14,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_contact_details
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path(@contact.uuid), as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ id: @contact.uuid,
|
||||
|
@ -43,8 +43,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_non_existent_contact
|
||||
get api_v1_registrant_contact_path('non-existent'), nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path('non-existent'), as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :not_found
|
||||
assert_equal({ errors: [base: ['Contact not found']] }, JSON.parse(response.body,
|
||||
|
@ -52,7 +52,7 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_anonymous_user
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path(@contact.uuid)
|
||||
|
||||
assert_response :unauthorized
|
||||
assert_equal({ errors: [base: ['Not authorized']] }, JSON.parse(response.body,
|
||||
|
@ -66,8 +66,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path(@contact.uuid), as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
end
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -78,8 +78,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
@contact.update!(ident: '12345')
|
||||
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path(@contact.uuid), as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :not_found
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
|
|
@ -20,8 +20,7 @@ class RegistrantApiV1ContactListTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US', @contact.ident_country_code
|
||||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contacts_path, as: :json, headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal 1, response_json.size
|
||||
|
@ -33,8 +32,7 @@ class RegistrantApiV1ContactListTest < ActionDispatch::IntegrationTest
|
|||
@contact = contacts(:acme_ltd)
|
||||
assert_equal 'acme-ltd-001', @contact.code
|
||||
|
||||
get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contacts_path, as: :json, headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal 1, response_json.size
|
||||
|
@ -48,8 +46,8 @@ class RegistrantApiV1ContactListTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do
|
||||
get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contacts_path, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
end
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
|
|
@ -21,12 +21,11 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
email: 'john@shop.test',
|
||||
phone: '+111.1')
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'William',
|
||||
email: 'william@shop.test',
|
||||
phone: '+222.2' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'William',
|
||||
email: 'william@shop.test',
|
||||
phone: '+222.2' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
assert_response :ok
|
||||
@contact.reload
|
||||
|
||||
|
@ -37,10 +36,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
|
||||
def test_notify_registrar
|
||||
assert_difference -> { @contact.registrar.notifications.count } do
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
end
|
||||
notification = @contact.registrar.notifications.last
|
||||
assert_equal 'Contact john-001 has been updated by registrant', notification.text
|
||||
|
@ -50,10 +48,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
@contact.update!(fax: '+666.6')
|
||||
ENV['fax_enabled'] = 'true'
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { fax: '+777.7' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { fax: '+777.7' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :ok
|
||||
@contact.reload
|
||||
|
@ -63,10 +60,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_fax_cannot_be_updated_when_disabled
|
||||
ENV['fax_enabled'] = 'false'
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { fax: '+823.7' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { fax: '+823.7' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :bad_request
|
||||
@contact.reload
|
||||
|
@ -80,14 +76,13 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_update_address_when_enabled
|
||||
Setting.address_processing = true
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { address: { city: 'new city',
|
||||
street: 'new street',
|
||||
zip: '92837',
|
||||
country_code: 'RU',
|
||||
state: 'new state' } }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { address: { city: 'new city',
|
||||
street: 'new street',
|
||||
zip: '92837',
|
||||
country_code: 'RU',
|
||||
state: 'new state' } },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :ok
|
||||
@contact.reload
|
||||
|
@ -99,10 +94,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
@contact.update!(street: 'any', zip: 'any', city: 'any', state: 'any', country_code: 'US')
|
||||
Setting.address_processing = true
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'any' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'any' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :ok
|
||||
end
|
||||
|
@ -111,11 +105,10 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
@contact.update!(street: 'old street')
|
||||
Setting.address_processing = false
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { address: { street: 'new street' } }
|
||||
.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||
params: { address: { street: 'new street' } },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
@contact.reload
|
||||
|
||||
assert_response :bad_request
|
||||
|
@ -130,10 +123,10 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
@contact.update!(ident_type: Contact::PRIV,
|
||||
disclosed_attributes: %w[])
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: %w[name] }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||
params: { disclosed_attributes: %w[name] },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
@contact.reload
|
||||
|
||||
assert_response :ok
|
||||
|
@ -143,10 +136,10 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_conceal_private_persons_data
|
||||
@contact.update!(ident_type: Contact::PRIV, disclosed_attributes: %w[name])
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: [] }.to_json,
|
||||
{ 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s }
|
||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||
params: { disclosed_attributes: [] },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
@contact.reload
|
||||
|
||||
|
@ -166,11 +159,10 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
assert_no_changes -> { @contact.disclosed_attributes } do
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: %w[name] }
|
||||
.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||
params: { disclosed_attributes: %w[name] },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
@contact.reload
|
||||
end
|
||||
assert_response :bad_request
|
||||
|
@ -182,10 +174,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_return_contact_details
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
assert_equal ({ id: @contact.uuid,
|
||||
name: 'new name',
|
||||
code: @contact.code,
|
||||
|
@ -211,10 +202,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_errors
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { phone: 'invalid' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { phone: 'invalid' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :bad_request
|
||||
assert_equal ({ errors: { phone: ['Phone nr is invalid'] } }), JSON.parse(response.body,
|
||||
|
@ -225,10 +215,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
@contact.update!(ident: '12345')
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
@contact.reload
|
||||
|
||||
assert_response :not_found
|
||||
|
@ -236,7 +225,8 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_non_existent_contact
|
||||
patch api_v1_registrant_contact_path('non-existent'), nil, 'HTTP_AUTHORIZATION' => auth_token
|
||||
patch api_v1_registrant_contact_path('non-existent'),
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
assert_response :not_found
|
||||
assert_equal ({ errors: [{ base: ['Not found'] }] }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
|
|
|
@ -15,8 +15,8 @@ class EppBaseTest < EppTestCase
|
|||
|
||||
begin
|
||||
assert_difference 'ApiLog::EppLog.count' do
|
||||
post '/epp/command/internal_error', { frame: valid_request_xml },
|
||||
'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post '/epp/command/internal_error', params: { frame: valid_request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :command_failed
|
||||
rescue
|
||||
|
@ -32,7 +32,8 @@ class EppBaseTest < EppTestCase
|
|||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
</epp>
|
||||
XML
|
||||
post valid_command_path, { frame: invalid_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post valid_command_path, params: { frame: invalid_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :syntax_error
|
||||
end
|
||||
|
@ -50,8 +51,8 @@ class EppBaseTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_info_path, { frame: xml_of_epp_command_that_requires_authentication },
|
||||
'HTTP_COOKIE' => 'session=non-existent'
|
||||
post epp_info_path, params: { frame: xml_of_epp_command_that_requires_authentication },
|
||||
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||
|
||||
assert_epp_response :authorization_error
|
||||
end
|
||||
|
@ -74,8 +75,8 @@ class EppBaseTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_info_path, { frame: xml_of_epp_command_that_requires_authorization },
|
||||
'HTTP_COOKIE' => "session=#{session.session_id}"
|
||||
post epp_info_path, params: { frame: xml_of_epp_command_that_requires_authorization },
|
||||
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
|
||||
|
||||
assert_epp_response :authorization_error
|
||||
end
|
||||
|
|
|
@ -14,7 +14,8 @@ class EppContactBaseTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
|
|
@ -21,7 +21,8 @@ class EppContactCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -42,7 +43,8 @@ class EppContactCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { '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 +67,8 @@ class EppContactCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { '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 +91,8 @@ class EppContactCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal 3, response_xml.xpath('//contact:cd', contact: xml_schema).size
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue