mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 10:16:01 +02:00
Merge branch 'master' into registry-314
This commit is contained in:
commit
3b28d91381
39 changed files with 459 additions and 74 deletions
|
@ -1,3 +1,6 @@
|
|||
28.02.2017
|
||||
* Add missing registrar's website field in UI
|
||||
|
||||
24.01.2017
|
||||
* Disallow EPP domain:update/transfer/delete if a domain has "deleteCandidate" status
|
||||
|
||||
|
|
39
README.md
39
README.md
|
@ -317,7 +317,8 @@ For Apache, REPP goes to port 443 in production, /etc/apache2/sites-enabled/repp
|
|||
SSLVerifyDepth 1
|
||||
SSLCACertificateFile /home/registry/registry/shared/ca/certs/ca.crt.pem
|
||||
SSLCARevocationPath /home/registry/registry/shared/ca/crl
|
||||
SSLCARevocationCheck chain
|
||||
# Uncomment this when upgrading to apache 2.4:
|
||||
# SSLCARevocationCheck chain
|
||||
|
||||
RequestHeader set SSL_CLIENT_S_DN_CN ""
|
||||
RequestHeader set SSL_CLIENT_CERT ""
|
||||
|
@ -340,6 +341,42 @@ For Apache, epp goes to port 700.
|
|||
Be sure to update paths to match your system configuration.
|
||||
/etc/apache2/sites-enabled/epp.conf short example:
|
||||
```apache
|
||||
<IfModule mod_ssl.c>
|
||||
Listen 127.0.0.1:8080
|
||||
<VirtualHost 127.0.0.1:8080>
|
||||
ServerName your-epp-backend-domain
|
||||
ServerAdmin your@example.com
|
||||
|
||||
PassengerEnabled on
|
||||
PassengerMinInstances 10
|
||||
PassengerMaxPoolSize 10
|
||||
PassengerPoolIdleTime 0
|
||||
PassengerMaxRequests 1000
|
||||
PassengerRoot "/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini"
|
||||
PassengerRuby "/home/registry/.rbenv/shims/ruby"
|
||||
|
||||
RailsEnv production # or staging
|
||||
DocumentRoot "/home/registry/registry/public"
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
LogLevel info
|
||||
ErrorLog "/var/log/apache2/eppback.error.log"
|
||||
CustomLog "/var/log/apache2/eppback.access.log" combined
|
||||
|
||||
<Directory />
|
||||
Options +FollowSymLinks -Indexes
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
|
||||
<Directory /home/registry/registry/public>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
Options -MultiViews -Indexes
|
||||
AllowOverride all
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_epp.c>
|
||||
Listen 700
|
||||
<VirtualHost *:700>
|
||||
|
|
|
@ -23,10 +23,10 @@ class Admin::RegistrarsController < AdminController
|
|||
@registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
|
||||
end
|
||||
|
||||
flash[:notice] = I18n.t('registrar_added')
|
||||
flash[:notice] = t('.created')
|
||||
redirect_to [:admin, @registrar]
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
flash.now[:alert] = I18n.t('failed_to_add_registrar')
|
||||
flash.now[:alert] = t('.not_created')
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
@ -35,10 +35,10 @@ class Admin::RegistrarsController < AdminController
|
|||
|
||||
def update
|
||||
if @registrar.update(registrar_params)
|
||||
flash[:notice] = I18n.t('registrar_updated')
|
||||
flash[:notice] = t('.updated')
|
||||
redirect_to [:admin, @registrar]
|
||||
else
|
||||
flash.now[:alert] = I18n.t('failed_to_update_registrar')
|
||||
flash.now[:alert] = t('.not_updated')
|
||||
render 'edit'
|
||||
end
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ class Admin::RegistrarsController < AdminController
|
|||
def registrar_params
|
||||
params.require(:registrar).permit(
|
||||
:name, :reg_no, :vat_no, :street, :city, :state, :zip, :billing_address,
|
||||
:country_code, :email, :phone, :billing_email, :code, :test_registrar
|
||||
:country_code, :email, :phone, :website, :billing_email, :code, :test_registrar
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class Registrar < ActiveRecord::Base
|
|||
has_many :priv_contacts, -> { privs }, class_name: 'Contact'
|
||||
has_many :white_ips, dependent: :destroy
|
||||
|
||||
delegate :balance, to: :cash_account
|
||||
delegate :balance, to: :cash_account, allow_nil: true
|
||||
|
||||
validates :name, :reg_no, :country_code, :email, :code, presence: true
|
||||
validates :name, :reg_no, :reference_no, :code, uniqueness: true
|
||||
|
@ -102,7 +102,7 @@ class Registrar < ActiveRecord::Base
|
|||
buyer_city: city,
|
||||
buyer_zip: zip,
|
||||
buyer_phone: phone,
|
||||
buyer_url: url,
|
||||
buyer_url: website,
|
||||
buyer_email: email,
|
||||
reference_no: reference_no,
|
||||
invoice_items_attributes: [
|
||||
|
|
|
@ -85,7 +85,7 @@ class WhoisRecord < ActiveRecord::Base
|
|||
|
||||
# update registar triggers when adding new attributes
|
||||
h[:registrar] = domain.registrar.name
|
||||
h[:registrar_url] = domain.registrar.url
|
||||
h[:registrar_website] = domain.registrar.website
|
||||
h[:registrar_phone] = domain.registrar.phone
|
||||
h[:registrar_address] = domain.registrar.address
|
||||
h[:registrar_changed] = domain.registrar.updated_at.try(:to_s, :iso8601)
|
||||
|
|
|
@ -16,8 +16,8 @@ class RegistrarPresenter
|
|||
registrar.phone
|
||||
end
|
||||
|
||||
def url
|
||||
registrar.url
|
||||
def website
|
||||
registrar.website
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:back), :back, class: 'btn btn-primary')
|
||||
= render 'shared/title', name: t(:epp_log)
|
||||
= render 'shared/title', name: t('.title')
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
= f.label :phone
|
||||
.col-md-7
|
||||
= f.text_field(:phone, class: 'form-control')
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :website
|
||||
.col-md-7
|
||||
= f.url_field :website, class: 'form-control'
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :email
|
||||
|
@ -75,7 +80,7 @@
|
|||
.col-md-8
|
||||
.panel.panel-default
|
||||
.panel-heading.clearfix
|
||||
.pull-left= t(:misc)
|
||||
.pull-left= t('.misc')
|
||||
.panel-body
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
|
@ -91,4 +96,4 @@
|
|||
%hr
|
||||
.row
|
||||
.col-md-8.text-right
|
||||
= button_tag(t(:save), class: 'btn btn-primary')
|
||||
= button_tag(t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:new), new_admin_registrar_path, class: 'btn btn-primary')
|
||||
= link_to(t('.new_btn'), new_admin_registrar_path, class: 'btn btn-primary')
|
||||
= render 'shared/title', name: t(:registrars)
|
||||
|
||||
.row
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
%dt= t(:credit_balance)
|
||||
%dd= @registrar.balance
|
||||
|
||||
%dt= Registrar.human_attribute_name :website
|
||||
%dd= @registrar.website
|
||||
|
||||
.col-md-6
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
|
|
|
@ -40,7 +40,7 @@ changed: <%= contact['changed'].to_s.tr('T',' ').sub('+', ' +') %>
|
|||
<%- end -%>
|
||||
Registrar:
|
||||
name: <%= json['registrar'] %>
|
||||
url: <%= json['registrar_url'] %>
|
||||
url: <%= json['registrar_website'] %>
|
||||
phone: <%= json['registrar_phone'] %>
|
||||
changed: <%= json['registrar_changed'].to_s.tr('T',' ').sub('+', ' +') %>
|
||||
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<%= registrar.name %><br>
|
||||
Email: <%= registrar.email %><br>
|
||||
Phone: <%= registrar.phone %><br>
|
||||
Website: <%= registrar.url %>
|
||||
Website: <%= registrar.website %>
|
||||
</p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= registrar.name %>
|
||||
Email: <%= registrar.email %>
|
||||
Phone: <%= registrar.phone %>
|
||||
Website: <%= registrar.url %>
|
||||
Website: <%= registrar.website %>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<%= registrar.name %><br>
|
||||
Email: <%= registrar.email %><br>
|
||||
Telefon: <%= registrar.phone %><br>
|
||||
Veebileht: <%= registrar.url %>
|
||||
Veebileht: <%= registrar.website %>
|
||||
</p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= registrar.name %>
|
||||
Email: <%= registrar.email %>
|
||||
Telefon: <%= registrar.phone %>
|
||||
Veebileht: <%= registrar.url %>
|
||||
Veebileht: <%= registrar.website %>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<%= registrar.name %><br>
|
||||
Электронная почта: <%= registrar.email %><br>
|
||||
Телефон: <%= registrar.phone %><br>
|
||||
Веб-сайт: <%= registrar.url %>
|
||||
Веб-сайт: <%= registrar.website %>
|
||||
</p>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= registrar.name %>
|
||||
Электронная почта: <%= registrar.email %>
|
||||
Телефон: <%= registrar.phone %>
|
||||
Веб-сайт: <%= registrar.url %>
|
||||
Веб-сайт: <%= registrar.website %>
|
||||
|
|
|
@ -133,34 +133,3 @@ payments_lhv_url: 'https://www.seb.ee/cgi-bin/dv.sh/ipank.r'
|
|||
payments_lhv_bank_certificate: 'eyp_pub.pem'
|
||||
payments_lhv_seller_private: 'kaupmees_priv.pem'
|
||||
payments_lhv_seller_account: 'testvpos'
|
||||
|
||||
#
|
||||
# AUTOTEST overwrites
|
||||
#
|
||||
test:
|
||||
webclient_ips: '127.0.0.1' # it should match to localhost ip address
|
||||
crl_dir: '/var/lib/jenkins/workspace/registry/ca/crl'
|
||||
crl_path: '/var/lib/jenkins/workspace/registry/ca/crl/crl.pem'
|
||||
ca_cert_path: '/var/lib/jenkins/workspace/registry/ca/certs/ca.crt.pem'
|
||||
ca_key_path: '/var/lib/jenkins/workspace/registry/ca/private/ca.key.pem'
|
||||
ca_key_password: 'test'
|
||||
cert_path: '/var/lib/jenkins/workspace/registry/ca/certs/webclient.crt.pem'
|
||||
|
||||
# Registrar/DEPP
|
||||
key_path: '/var/lib/jenkins/workspace/registry/ca/private/webclient.key.pem'
|
||||
epp_hostname: '127.0.0.1'
|
||||
repp_url: 'http://127.0.0.1:8989/repp/v1/'
|
||||
|
||||
|
||||
#
|
||||
# DEVELOPMENT overwrites
|
||||
#
|
||||
development:
|
||||
epp_hostname: '127.0.0.1'
|
||||
repp_url: 'http://127.0.0.1:8080/repp/v1/'
|
||||
cert_path: 'ca/certs/webclient.cert.pem'
|
||||
key_path: 'ca/private/webclient.key.pem'
|
||||
crl_dir: 'ca/crl'
|
||||
ca_cert_path: 'ca/certs/ca.crt.pem'
|
||||
ca_key_path: 'ca/private/ca.key.pem'
|
||||
ca_key_password: 'your-root-key-password'
|
||||
|
|
|
@ -4,3 +4,5 @@ en:
|
|||
index:
|
||||
title: EPP log
|
||||
reset_btn: Reset
|
||||
show:
|
||||
title: EPP log
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
en:
|
||||
admin:
|
||||
registrars:
|
||||
index:
|
||||
new_btn: New registrar
|
||||
|
||||
show:
|
||||
new_api_use_btn: New API user
|
||||
active: Active
|
||||
api_users: API users
|
||||
|
||||
create:
|
||||
created: Registrar has been successfully created
|
||||
not_created: Unable to create registrar
|
||||
|
||||
update:
|
||||
updated: Registrar has been successfully updated
|
||||
not_updated: Unable to update registrar
|
||||
|
||||
form:
|
||||
misc: Miscellaneous
|
||||
create_btn: Create registrar
|
||||
update_btn: Update registrar
|
||||
|
|
|
@ -395,14 +395,10 @@ en:
|
|||
history: 'History'
|
||||
|
||||
new_registrar: 'New registrar'
|
||||
registrar_added: 'Registrar added!'
|
||||
failed_to_add_registrar: 'Failed to add registrar'
|
||||
registrar_details: 'Registrar details'
|
||||
vat_no: 'VAT no'
|
||||
edit_registrar: 'Edit registrar'
|
||||
back_to_registrar: 'Back to registrar'
|
||||
registrar_updated: 'Registrar updated'
|
||||
failed_to_update_registrar: 'Failed to update registrar'
|
||||
registrar_deleted: 'Registrar deleted'
|
||||
failed_to_delete_registrar: 'Failed to delete registrar'
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RenameRegistrarUrlToWebsite < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :registrars, :url, :website
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20161227193500) do
|
||||
ActiveRecord::Schema.define(version: 20170221115548) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -1046,7 +1046,7 @@ ActiveRecord::Schema.define(version: 20161227193500) do
|
|||
t.string "street"
|
||||
t.string "zip"
|
||||
t.string "code"
|
||||
t.string "url"
|
||||
t.string "website"
|
||||
t.string "directo_handle"
|
||||
t.boolean "vat"
|
||||
t.integer "legacy_id"
|
||||
|
|
|
@ -2704,7 +2704,7 @@ CREATE TABLE registrars (
|
|||
street character varying,
|
||||
zip character varying,
|
||||
code character varying,
|
||||
url character varying,
|
||||
website character varying,
|
||||
directo_handle character varying,
|
||||
vat boolean,
|
||||
legacy_id integer,
|
||||
|
@ -5278,3 +5278,5 @@ INSERT INTO schema_migrations (version) VALUES ('20161004101419');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20161227193500');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20170221115548');
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ Fabricator(:eis, from: :registrar) do
|
|||
city 'Tallinn'
|
||||
street 'Paldiski mnt 80'
|
||||
zip '10617'
|
||||
url 'www.internet.ee'
|
||||
website 'www.internet.ee'
|
||||
code { sequence(:code) { |i| "EIS#{i}" } }
|
||||
accounts(count: 1) { Fabricate(:account, account_activities: []) }
|
||||
end
|
||||
|
|
20
spec/features/admin/registrars/create_spec.rb
Normal file
20
spec/features/admin/registrars/create_spec.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'New registrar' do
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'creates registrar' do
|
||||
visit admin_registrars_url
|
||||
click_link_or_button 'New registrar'
|
||||
|
||||
fill_in 'registrar[name]', with: 'test'
|
||||
fill_in 'registrar[reg_no]', with: '1234567'
|
||||
fill_in 'registrar[email]', with: 'test@test.com'
|
||||
fill_in 'registrar[code]', with: 'test'
|
||||
click_link_or_button 'Create registrar'
|
||||
|
||||
expect(page).to have_text('Registrar has been successfully created')
|
||||
end
|
||||
end
|
18
spec/features/admin/registrars/edit_spec.rb
Normal file
18
spec/features/admin/registrars/edit_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Edit registrar' do
|
||||
given!(:registrar) { create(:registrar) }
|
||||
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'updates registrar' do
|
||||
visit admin_registrar_url(registrar)
|
||||
click_link_or_button 'Edit'
|
||||
|
||||
click_link_or_button 'Update registrar'
|
||||
|
||||
expect(page).to have_text('Registrar has been successfully updated')
|
||||
end
|
||||
end
|
|
@ -607,7 +607,6 @@ end
|
|||
|
||||
RSpec.describe Domain, db: false do
|
||||
it { is_expected.to alias_attribute(:on_hold_time, :outzone_at) }
|
||||
it { is_expected.to alias_attribute(:force_delete_time, :force_delete_at) }
|
||||
it { is_expected.to alias_attribute(:outzone_time, :outzone_at) }
|
||||
|
||||
describe 'nameserver validation', db: true do
|
||||
|
|
|
@ -25,10 +25,10 @@ RSpec.describe RegistrarPresenter do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#url' do
|
||||
it 'returns url' do
|
||||
expect(registrar).to receive(:url).and_return('test url')
|
||||
expect(presenter.url).to eq('test url')
|
||||
describe '#website' do
|
||||
it 'returns website' do
|
||||
expect(registrar).to receive(:website).and_return('test')
|
||||
expect(presenter.website).to eq('test')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,10 +31,9 @@ RSpec.configure do |config|
|
|||
config.include ActiveSupport::Testing::TimeHelpers
|
||||
config.include Requests::SessionHelpers, type: :request
|
||||
config.include Features::SessionHelpers, type: :feature
|
||||
config.include AbstractController::Translation, type: :request
|
||||
config.include AbstractController::Translation, type: :feature
|
||||
config.include Requests::EPPHelpers, epp: true
|
||||
|
||||
config.include Requests::EPPHelpers, epp: true
|
||||
config.include Requests::EPPHelpers, type: :request
|
||||
|
||||
config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata|
|
||||
metadata[:db] = true if metadata[:db].nil?
|
||||
|
@ -60,10 +59,6 @@ RSpec.configure do |config|
|
|||
metadata[:type] = :request
|
||||
end
|
||||
|
||||
config.define_derived_metadata(file_path: %r[/spec/requests/epp/]) do |metadata|
|
||||
metadata[:epp] = true if metadata[:epp].nil?
|
||||
end
|
||||
|
||||
config.use_transactional_fixtures = false
|
||||
config.infer_spec_type_from_file_location!
|
||||
|
||||
|
|
24
spec/requests/admin/registrars/create_spec.rb
Normal file
24
spec/requests/admin/registrars/create_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin registrar create' do
|
||||
subject(:registrar) { Registrar.first }
|
||||
|
||||
before :example do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'creates new registrar' do
|
||||
expect { post admin_registrars_path, registrar: attributes_for(:registrar) }
|
||||
.to change { Registrar.count }.from(0).to(1)
|
||||
end
|
||||
|
||||
it 'saves website' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar, website: 'test') }
|
||||
expect(registrar.website).to eq('test')
|
||||
end
|
||||
|
||||
it 'redirects to :show' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar) }
|
||||
expect(response).to redirect_to admin_registrar_path(registrar)
|
||||
end
|
||||
end
|
24
spec/requests/admin/registrars/update_spec.rb
Normal file
24
spec/requests/admin/registrars/update_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin registrar update' do
|
||||
before :example do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'updates website' do
|
||||
registrar = create(:registrar, website: 'test')
|
||||
|
||||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar, website: 'new-website')
|
||||
registrar.reload
|
||||
|
||||
expect(registrar.website).to eq('new-website')
|
||||
end
|
||||
|
||||
it 'redirects to :show' do
|
||||
registrar = create(:registrar)
|
||||
|
||||
patch admin_registrar_path(registrar), { registrar: attributes_for(:registrar) }
|
||||
|
||||
expect(response).to redirect_to admin_registrar_path(registrar)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,196 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'EPP domain:update' do
|
||||
let(:request) { post '/epp/command/update', frame: request_xml }
|
||||
let!(:registrant) { create(:registrant, code: 'old-code') }
|
||||
let!(:domain) { create(:domain, name: 'test.com', registrant: registrant) }
|
||||
let!(:new_registrant) { create(:registrant, code: 'new-code') }
|
||||
|
||||
before :example do
|
||||
sign_in_to_epp_area
|
||||
end
|
||||
|
||||
context 'when registrant change confirmation is enabled' do
|
||||
before :example do
|
||||
Setting.request_confrimation_on_registrant_change_enabled = true
|
||||
end
|
||||
|
||||
context 'when verified' do
|
||||
let(:request_xml) { <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>test.com</domain:name>
|
||||
<domain:chg>
|
||||
<domain:registrant verified="yes">new-code</domain:registrant>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
}
|
||||
|
||||
specify do
|
||||
request
|
||||
expect(response).to have_code_of(1000)
|
||||
end
|
||||
|
||||
it 'changes registrant' do
|
||||
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
|
||||
end
|
||||
|
||||
it 'does not send confirmation email' do
|
||||
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||
end
|
||||
|
||||
it 'does not set PENDING_UPDATE status to domain' do
|
||||
request
|
||||
domain.reload
|
||||
expect(domain.statuses).to_not include(DomainStatus::PENDING_UPDATE)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when not verified' do
|
||||
let(:request_xml) { <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>test.com</domain:name>
|
||||
<domain:chg>
|
||||
<domain:registrant verified="no">new-code</domain:registrant>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
}
|
||||
|
||||
specify do
|
||||
request
|
||||
expect(response).to have_code_of(1001)
|
||||
end
|
||||
|
||||
it 'does not change registrant' do
|
||||
expect { request; domain.reload }.to_not change { domain.registrant_code }
|
||||
end
|
||||
|
||||
it 'sends confirmation and notice emails' do
|
||||
expect { request }.to change { ActionMailer::Base.deliveries.count }.by(2)
|
||||
end
|
||||
|
||||
it 'sets PENDING_UPDATE status to domain' do
|
||||
request
|
||||
domain.reload
|
||||
expect(domain.statuses).to include(DomainStatus::PENDING_UPDATE)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when registrant change confirmation is disabled' do
|
||||
before :example do
|
||||
Setting.request_confrimation_on_registrant_change_enabled = false
|
||||
end
|
||||
|
||||
context 'when verified' do
|
||||
let(:request_xml) { <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>test.com</domain:name>
|
||||
<domain:chg>
|
||||
<domain:registrant verified="yes">new-code</domain:registrant>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
}
|
||||
|
||||
specify do
|
||||
request
|
||||
expect(response).to have_code_of(1000)
|
||||
end
|
||||
|
||||
it 'changes registrant' do
|
||||
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
|
||||
end
|
||||
|
||||
it 'does not send confirmation email' do
|
||||
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||
end
|
||||
|
||||
it 'does not set PENDING_UPDATE status to domain' do
|
||||
request
|
||||
domain.reload
|
||||
expect(domain.statuses).to_not include(DomainStatus::PENDING_UPDATE)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when not verified' do
|
||||
let(:request_xml) { <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>test.com</domain:name>
|
||||
<domain:chg>
|
||||
<domain:registrant verified="no">new-code</domain:registrant>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{valid_legal_document}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
}
|
||||
|
||||
specify do
|
||||
request
|
||||
expect(response).to have_code_of(1000)
|
||||
end
|
||||
|
||||
it 'changes registrant' do
|
||||
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
|
||||
end
|
||||
|
||||
it 'does not send confirmation email' do
|
||||
expect { request }.to_not change { ActionMailer::Base.deliveries.count }
|
||||
end
|
||||
|
||||
it 'does not set PENDING_UPDATE status to domain' do
|
||||
request
|
||||
domain.reload
|
||||
expect(domain.statuses).to_not include(DomainStatus::PENDING_UPDATE)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
33
spec/routing/admin/registrars_routing_spec.rb
Normal file
33
spec/routing/admin/registrars_routing_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::RegistrarsController do
|
||||
describe 'routing' do
|
||||
it 'routes to #index' do
|
||||
expect(get: '/admin/registrars').to route_to('admin/registrars#index')
|
||||
end
|
||||
|
||||
it 'routes to #new' do
|
||||
expect(get: '/admin/registrars/new').to route_to('admin/registrars#new')
|
||||
end
|
||||
|
||||
it 'routes to #show' do
|
||||
expect(get: '/admin/registrars/1').to route_to('admin/registrars#show', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #edit' do
|
||||
expect(get: '/admin/registrars/1/edit').to route_to('admin/registrars#edit', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #create' do
|
||||
expect(post: '/admin/registrars').to route_to('admin/registrars#create')
|
||||
end
|
||||
|
||||
it 'routes to #update' do
|
||||
expect(patch: '/admin/registrars/1').to route_to('admin/registrars#update', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #destroy' do
|
||||
expect(delete: '/admin/registrars/1').to route_to('admin/registrars#destroy', id: '1')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -3,5 +3,9 @@ module Requests
|
|||
def have_code_of(*args)
|
||||
Matchers::EPP::Code.new(*args)
|
||||
end
|
||||
|
||||
def valid_legal_document
|
||||
Base64.encode64('a' * 5000)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,5 +28,9 @@ module Requests
|
|||
|
||||
post '/epp/session/login', frame: login_xml
|
||||
end
|
||||
|
||||
def sign_in_to_admin_area(user: FactoryGirl.create(:admin_user))
|
||||
post admin_sessions_path, admin_user: { username: user.username, password: user.password }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
15
spec/views/admin/registrars/_form.haml_spec.rb
Normal file
15
spec/views/admin/registrars/_form.haml_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin/registrars/_form' do
|
||||
let(:registrar) { build_stubbed(:registrar) }
|
||||
|
||||
before :example do
|
||||
assign(:registrar, registrar)
|
||||
stub_template 'shared/_full_errors' => ''
|
||||
end
|
||||
|
||||
it 'has website' do
|
||||
render
|
||||
expect(rendered).to have_css('[name="registrar[website]"]')
|
||||
end
|
||||
end
|
15
spec/views/admin/registrars/show.haml_spec.rb
Normal file
15
spec/views/admin/registrars/show.haml_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin/registrars/show' do
|
||||
let(:registrar) { build_stubbed(:registrar, website: 'test website') }
|
||||
|
||||
before :example do
|
||||
assign(:registrar, registrar)
|
||||
stub_template 'shared/_title' => ''
|
||||
end
|
||||
|
||||
it 'has website' do
|
||||
render
|
||||
expect(rendered).to have_text('test website')
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@ RSpec.shared_examples 'domain mailer registrar info' do
|
|||
name
|
||||
email
|
||||
phone
|
||||
url
|
||||
website
|
||||
)
|
||||
|
||||
attributes.each do |attr_name|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue