mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
Merge branch 'master' into registry-662
This commit is contained in:
commit
72dcb24e3e
24 changed files with 201 additions and 155 deletions
|
@ -275,7 +275,7 @@ GEM
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nokogiri (1.8.1)
|
nokogiri (1.8.2)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.3.0)
|
||||||
nori (2.6.0)
|
nori (2.6.0)
|
||||||
open4 (1.3.4)
|
open4 (1.3.4)
|
||||||
|
|
|
@ -5,6 +5,11 @@ module Concerns::Domain::Deletable
|
||||||
alias_attribute :delete_time, :delete_at
|
alias_attribute :delete_time, :delete_at
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def discard
|
||||||
|
statuses << DomainStatus::DELETE_CANDIDATE
|
||||||
|
save
|
||||||
|
end
|
||||||
|
|
||||||
def discarded?
|
def discarded?
|
||||||
statuses.include?(DomainStatus::DELETE_CANDIDATE)
|
statuses.include?(DomainStatus::DELETE_CANDIDATE)
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,6 +23,12 @@ class WhoisRecord < ActiveRecord::Base
|
||||||
h = HashWithIndifferentAccess.new
|
h = HashWithIndifferentAccess.new
|
||||||
return h if domain.blank?
|
return h if domain.blank?
|
||||||
|
|
||||||
|
if domain.discarded?
|
||||||
|
h[:name] = domain.name
|
||||||
|
h[:status] = ['deleteCandidate']
|
||||||
|
return h
|
||||||
|
end
|
||||||
|
|
||||||
status_map = {
|
status_map = {
|
||||||
'ok' => 'ok (paid and in zone)'
|
'ok' => 'ok (paid and in zone)'
|
||||||
}
|
}
|
||||||
|
@ -34,7 +40,7 @@ class WhoisRecord < ActiveRecord::Base
|
||||||
h[:status] = domain.statuses.map { |x| status_map[x] || x }
|
h[:status] = domain.statuses.map { |x| status_map[x] || x }
|
||||||
h[:registered] = domain.registered_at.try(:to_s, :iso8601)
|
h[:registered] = domain.registered_at.try(:to_s, :iso8601)
|
||||||
h[:changed] = domain.updated_at.try(:to_s, :iso8601)
|
h[:changed] = domain.updated_at.try(:to_s, :iso8601)
|
||||||
h[:expire] = domain.valid_to.try(:to_date).try(:to_s)
|
h[:expire] = domain.valid_to.to_date.to_s
|
||||||
h[:outzone] = domain.outzone_at.try(:to_date).try(:to_s)
|
h[:outzone] = domain.outzone_at.try(:to_date).try(:to_s)
|
||||||
h[:delete] = [domain.delete_at, domain.force_delete_at].compact.min.try(:to_date).try(:to_s)
|
h[:delete] = [domain.delete_at, domain.force_delete_at].compact.min.try(:to_date).try(:to_s)
|
||||||
|
|
||||||
|
@ -88,7 +94,8 @@ class WhoisRecord < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def generated_body
|
def generated_body
|
||||||
template = Rails.root.join("app/views/for_models/whois.erb".freeze)
|
template_name = domain.discarded? ? 'whois_discarded.erb' : 'whois.erb'
|
||||||
|
template = Rails.root.join("app/views/for_models/#{template_name}".freeze)
|
||||||
ERB.new(template.read, nil, "-").result(binding)
|
ERB.new(template.read, nil, "-").result(binding)
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/MethodLength
|
# rubocop:enable Metrics/MethodLength
|
||||||
|
|
|
@ -6,6 +6,17 @@ class DomainPresenter
|
||||||
@view = view
|
@view = view
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def name_with_status
|
||||||
|
html = domain.name
|
||||||
|
|
||||||
|
if domain.discarded?
|
||||||
|
label = view.content_tag(:span, 'deleteCandidate', class: 'label label-warning')
|
||||||
|
html += " #{label}"
|
||||||
|
end
|
||||||
|
|
||||||
|
html.html_safe
|
||||||
|
end
|
||||||
|
|
||||||
def expire_time
|
def expire_time
|
||||||
view.l(domain.expire_time)
|
view.l(domain.expire_time)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
- content_for :actions do
|
|
||||||
= link_to(t(:edit_statuses), edit_admin_domain_path(@domain), class: 'btn btn-primary')
|
|
||||||
= link_to(t(:history), admin_domain_domain_versions_path(@domain.id), method: :get, class: 'btn btn-primary')
|
|
||||||
|
|
||||||
= render 'shared/title', name: @domain.name
|
|
||||||
|
|
||||||
.row
|
|
||||||
.col-md-6= render 'admin/domains/partials/general'
|
|
||||||
.col-md-6= render 'admin/domains/partials/owner'
|
|
||||||
.row
|
|
||||||
.col-md-12= render 'admin/domains/partials/tech_contacts'
|
|
||||||
.row
|
|
||||||
.col-md-12= render 'admin/domains/partials/admin_contacts'
|
|
||||||
.row
|
|
||||||
.col-md-12= render 'admin/domains/partials/statuses'
|
|
||||||
.row
|
|
||||||
.col-md-12= render 'admin/domains/partials/nameservers'
|
|
||||||
.row
|
|
||||||
.col-md-12= render 'admin/domains/partials/dnskeys'
|
|
||||||
.row
|
|
||||||
.col-md-12= render 'admin/domains/partials/keyrelays'
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
= render 'admin/domains/partials/legal_documents', legal_documents: @domain.legal_documents
|
|
71
app/views/admin/domains/show.html.erb
Normal file
71
app/views/admin/domains/show.html.erb
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
<% domain = DomainPresenter.new(domain: @domain, view: self) %>
|
||||||
|
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li><%= link_to t('admin.domains.index.header'), admin_domains_path %></li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<h1><%= domain.name_with_status %></h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-4 text-right">
|
||||||
|
<%= link_to t('.edit_btn'), edit_admin_domain_path(@domain), class: 'btn btn-primary' %>
|
||||||
|
<%= link_to t('.history_btn'), admin_domain_domain_versions_path(@domain),
|
||||||
|
class: 'btn btn-primary' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<%= render 'admin/domains/partials/general' %>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<%= render 'admin/domains/partials/owner' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= render 'admin/domains/partials/tech_contacts' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= render 'admin/domains/partials/admin_contacts' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= render 'admin/domains/partials/statuses' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= render 'admin/domains/partials/nameservers' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= render 'admin/domains/partials/dnskeys' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= render 'admin/domains/partials/keyrelays' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<%= render 'admin/domains/partials/legal_documents', legal_documents:
|
||||||
|
@domain.legal_documents %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,8 +0,0 @@
|
||||||
- content_for :actions do
|
|
||||||
= link_to(t(:back_to_domain), admin_domain_path(@domain), class: 'btn btn-default')
|
|
||||||
= render 'shared/title', name: t(:zonefile)
|
|
||||||
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
= preserve do
|
|
||||||
%pre= @zonefile
|
|
|
@ -8,7 +8,7 @@ xml.epp_head do
|
||||||
xml.tag!('domain:creData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
|
xml.tag!('domain:creData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
|
||||||
xml.tag!('domain:name', @domain.name)
|
xml.tag!('domain:name', @domain.name)
|
||||||
xml.tag!('domain:crDate', @domain.created_at.try(:iso8601))
|
xml.tag!('domain:crDate', @domain.created_at.try(:iso8601))
|
||||||
xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601))
|
xml.tag!('domain:exDate', @domain.valid_to.iso8601)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ xml.epp_head do
|
||||||
xml.tag!('domain:upDate', @domain.updated_at.try(:iso8601))
|
xml.tag!('domain:upDate', @domain.updated_at.try(:iso8601))
|
||||||
end
|
end
|
||||||
|
|
||||||
xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601))
|
xml.tag!('domain:exDate', @domain.valid_to.iso8601)
|
||||||
|
|
||||||
# TODO Make domain transferrable
|
# TODO Make domain transferrable
|
||||||
#xml.tag!('domain:trDate', @domain.transferred_at) if @domain.transferred_at
|
#xml.tag!('domain:trDate', @domain.transferred_at) if @domain.transferred_at
|
||||||
|
|
|
@ -5,5 +5,5 @@ builder.tag!('domain:trnData', 'xmlns:domain' => 'https://epp.tld.ee/schema/doma
|
||||||
builder.tag!('domain:reDate', dt.transfer_requested_at.try(:iso8601))
|
builder.tag!('domain:reDate', dt.transfer_requested_at.try(:iso8601))
|
||||||
builder.tag!('domain:acID', dt.old_registrar.code)
|
builder.tag!('domain:acID', dt.old_registrar.code)
|
||||||
builder.tag!('domain:acDate', dt.transferred_at.try(:iso8601) || dt.wait_until.try(:iso8601))
|
builder.tag!('domain:acDate', dt.transferred_at.try(:iso8601) || dt.wait_until.try(:iso8601))
|
||||||
builder.tag!('domain:exDate', dt.domain_valid_to.try(:iso8601))
|
builder.tag!('domain:exDate', dt.domain_valid_to.iso8601)
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ xml.epp_head do
|
||||||
xml.resData do
|
xml.resData do
|
||||||
xml.tag!('domain:renData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
|
xml.tag!('domain:renData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do
|
||||||
xml.tag!('domain:name', @domain[:name])
|
xml.tag!('domain:name', @domain[:name])
|
||||||
xml.tag!('domain:exDate', @domain.valid_to.try(:iso8601))
|
xml.tag!('domain:exDate', @domain.valid_to.iso8601)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
8
app/views/for_models/whois_discarded.erb
Normal file
8
app/views/for_models/whois_discarded.erb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
Estonia .ee Top Level Domain WHOIS server
|
||||||
|
|
||||||
|
Domain:
|
||||||
|
name: <%= json['name'] %>
|
||||||
|
status: <%= json['status'] %>
|
||||||
|
|
||||||
|
Estonia .ee Top Level Domain WHOIS server
|
||||||
|
More information at http://internet.ee
|
|
@ -5,6 +5,10 @@ en:
|
||||||
header: Domains
|
header: Domains
|
||||||
registrant: Registrant
|
registrant: Registrant
|
||||||
|
|
||||||
|
show:
|
||||||
|
edit_btn: Edit statuses
|
||||||
|
history_btn: History
|
||||||
|
|
||||||
search_form:
|
search_form:
|
||||||
reset_btn: Reset
|
reset_btn: Reset
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,6 @@ en:
|
||||||
|
|
||||||
transfer_requested: 'Transfer requested.'
|
transfer_requested: 'Transfer requested.'
|
||||||
message_was_not_found: 'Message was not found'
|
message_was_not_found: 'Message was not found'
|
||||||
zonefile: 'Zonefile'
|
|
||||||
only_one_parameter_allowed: 'Only one parameter allowed: %{param_1} or %{param_2}'
|
only_one_parameter_allowed: 'Only one parameter allowed: %{param_1} or %{param_2}'
|
||||||
exactly_one_parameter_required: 'Exactly one parameter required: %{params}'
|
exactly_one_parameter_required: 'Exactly one parameter required: %{params}'
|
||||||
ds_data_with_key_allowed: 'Allow DS data with key'
|
ds_data_with_key_allowed: 'Allow DS data with key'
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ChangeDomainsValidToToNotNull < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_column_null :domains, :valid_to, false
|
||||||
|
end
|
||||||
|
end
|
|
@ -872,7 +872,7 @@ CREATE TABLE domains (
|
||||||
registrar_id integer NOT NULL,
|
registrar_id integer NOT NULL,
|
||||||
registered_at timestamp without time zone,
|
registered_at timestamp without time zone,
|
||||||
status character varying,
|
status character varying,
|
||||||
valid_to timestamp without time zone,
|
valid_to timestamp without time zone NOT NULL,
|
||||||
registrant_id integer NOT NULL,
|
registrant_id integer NOT NULL,
|
||||||
transfer_code character varying NOT NULL,
|
transfer_code character varying NOT NULL,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
|
@ -4714,3 +4714,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180314122722');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20180327151906');
|
INSERT INTO schema_migrations (version) VALUES ('20180327151906');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180331200125');
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ FactoryBot.define do
|
||||||
sequence(:name) { |n| "test#{n}.com" }
|
sequence(:name) { |n| "test#{n}.com" }
|
||||||
period 1
|
period 1
|
||||||
period_unit 'y' # Year
|
period_unit 'y' # Year
|
||||||
|
valid_to Time.zone.parse('2010-07-05')
|
||||||
registrar
|
registrar
|
||||||
registrant
|
registrant
|
||||||
|
|
||||||
|
@ -10,9 +11,5 @@ FactoryBot.define do
|
||||||
domain.admin_domain_contacts << FactoryBot.build(:admin_domain_contact)
|
domain.admin_domain_contacts << FactoryBot.build(:admin_domain_contact)
|
||||||
domain.tech_domain_contacts << FactoryBot.build(:tech_domain_contact)
|
domain.tech_domain_contacts << FactoryBot.build(:tech_domain_contact)
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :domain_discarded do
|
|
||||||
statuses [DomainStatus::DELETE_CANDIDATE]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Domain, db: false do
|
|
||||||
it { is_expected.to alias_attribute(:delete_time, :delete_at) }
|
|
||||||
|
|
||||||
describe '#discarded?' do
|
|
||||||
context 'when :deleteCandidate status is present' do
|
|
||||||
let(:domain) { described_class.new(statuses: [DomainStatus::DELETE_CANDIDATE]) }
|
|
||||||
|
|
||||||
specify { expect(domain).to be_discarded }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when :deleteCandidate status is absent' do
|
|
||||||
let(:domain) { described_class.new(statuses: []) }
|
|
||||||
|
|
||||||
specify { expect(domain).to_not be_discarded }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,47 +0,0 @@
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe 'EPP domain:delete' do
|
|
||||||
let(:registrar) { create(:registrar) }
|
|
||||||
let(:user) { create(:api_user_epp, registrar: registrar) }
|
|
||||||
let(:session_id) { create(:epp_session, user: user).session_id }
|
|
||||||
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>
|
|
||||||
<delete>
|
|
||||||
<domain:delete xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
|
||||||
<domain:name>test.com</domain:name>
|
|
||||||
</domain:delete>
|
|
||||||
</delete>
|
|
||||||
<extension>
|
|
||||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
|
||||||
<eis:legalDocument type="pdf">dGVzdCBmYWlsCg==</eis:legalDocument>
|
|
||||||
</eis:extdata>
|
|
||||||
</extension>
|
|
||||||
</command>
|
|
||||||
</epp>
|
|
||||||
XML
|
|
||||||
}
|
|
||||||
|
|
||||||
before :example do
|
|
||||||
login_as user
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when domain is not discarded' do
|
|
||||||
let!(:domain) { create(:domain, name: 'test.com') }
|
|
||||||
|
|
||||||
it 'returns epp code of 1001' do
|
|
||||||
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}"
|
|
||||||
expect(response).to have_code_of(1001)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when domain is discarded' do
|
|
||||||
let!(:domain) { create(:domain_discarded, name: 'test.com') }
|
|
||||||
|
|
||||||
it 'returns epp code of 2105' do
|
|
||||||
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}"
|
|
||||||
expect(response).to have_code_of(2105)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,42 +0,0 @@
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe 'EPP domain:update' do
|
|
||||||
let(:registrar) { create(:registrar) }
|
|
||||||
let(:user) { create(:api_user_epp, registrar: registrar) }
|
|
||||||
let(:session_id) { create(:epp_session, user: user).session_id }
|
|
||||||
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:update>
|
|
||||||
</update>
|
|
||||||
</command>
|
|
||||||
</epp>
|
|
||||||
XML
|
|
||||||
}
|
|
||||||
|
|
||||||
before :example do
|
|
||||||
login_as user
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when domain is not discarded' do
|
|
||||||
let!(:domain) { create(:domain, name: 'test.com') }
|
|
||||||
|
|
||||||
it 'returns epp code of 1000' do
|
|
||||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}"
|
|
||||||
expect(response).to have_code_of(1000)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when domain is discarded' do
|
|
||||||
let!(:domain) { create(:domain_discarded, name: 'test.com') }
|
|
||||||
|
|
||||||
it 'returns epp code of 2105' do
|
|
||||||
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session_id}"
|
|
||||||
expect(response).to have_code_of(2105)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
16
test/integration/admin/domains/details_test.rb
Normal file
16
test/integration/admin/domains/details_test.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class AdminAreaDomainDetailsTest < ActionDispatch::IntegrationTest
|
||||||
|
setup do
|
||||||
|
login_as users(:admin)
|
||||||
|
@domain = domains(:shop)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_discarded_domain_has_corresponding_label
|
||||||
|
visit admin_domain_url(@domain)
|
||||||
|
assert_no_css 'span.label.label-warning', text: 'deleteCandidate'
|
||||||
|
@domain.discard
|
||||||
|
visit admin_domain_url(@domain)
|
||||||
|
assert_css 'span.label.label-warning', text: 'deleteCandidate'
|
||||||
|
end
|
||||||
|
end
|
|
@ -25,4 +25,31 @@ class EppDomainDeleteTest < ActionDispatch::IntegrationTest
|
||||||
assert_equal '1001', Nokogiri::XML(response.body).at_css('result')[:code]
|
assert_equal '1001', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_discarded_domain_cannot_be_deleted
|
||||||
|
domains(:shop).discard
|
||||||
|
|
||||||
|
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>
|
||||||
|
<delete>
|
||||||
|
<domain:delete xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>shop.test</domain:name>
|
||||||
|
</domain:delete>
|
||||||
|
</delete>
|
||||||
|
<extension>
|
||||||
|
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||||
|
<eis:legalDocument type="pdf">dGVzdCBmYWlsCg==</eis:legalDocument>
|
||||||
|
</eis:extdata>
|
||||||
|
</extension>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
|
||||||
|
assert_no_difference 'Domain.count' do
|
||||||
|
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||||
|
end
|
||||||
|
assert_equal '2105', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppDomainUpdateTest < ActionDispatch::IntegrationTest
|
class EppDomainUpdateTest < ActionDispatch::IntegrationTest
|
||||||
def test_overwrites_existing
|
def test_update_domain
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
@ -20,9 +20,29 @@ class EppDomainUpdateTest < ActionDispatch::IntegrationTest
|
||||||
</epp>
|
</epp>
|
||||||
XML
|
XML
|
||||||
|
|
||||||
post '/epp/command/update', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||||
assert_equal 'f0ff7d17b0', domains(:shop).transfer_code
|
assert_equal 'f0ff7d17b0', domains(:shop).transfer_code
|
||||||
assert_equal '1000', Nokogiri::XML(response.body).at_css('result')[:code]
|
assert_equal '1000', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||||
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
assert_equal 1, Nokogiri::XML(response.body).css('result').size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_discarded_domain_cannot_be_updated
|
||||||
|
domains(:shop).discard
|
||||||
|
|
||||||
|
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>shop.test</domain:name>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
|
||||||
|
post '/epp/command/update', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||||
|
assert_equal '2105', Nokogiri::XML(response.body).at_css('result')[:code]
|
||||||
|
end
|
||||||
end
|
end
|
14
test/models/domain/deletable_test.rb
Normal file
14
test/models/domain/deletable_test.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class DomainDeletableTest < ActiveSupport::TestCase
|
||||||
|
setup do
|
||||||
|
@domain = domains(:shop)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_discard
|
||||||
|
refute @domain.discarded?
|
||||||
|
@domain.discard
|
||||||
|
@domain.reload
|
||||||
|
assert @domain.discarded?
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue