Merge branch 'master' into registry-623

This commit is contained in:
Artur Beljajev 2018-04-04 16:32:17 +03:00
commit 5c34d9f468
8 changed files with 167 additions and 7 deletions

View file

@ -1,3 +1,12 @@
03.04.2018
* BUG: Fixed bug with sometimes failing bank-link payments [#642](https://github.com/internetee/registry/issues/642)
* EPP: Domain and associated objects are now validated on domain renew [#678](https://github.com/internetee/registry/issues/678)
* Admin: drop uniqueness requirement from registrar's registry number field [#776](https://github.com/internetee/registry/issues/776)
* Security: Loofah gem update to 2.2.2 [#783](https://github.com/internetee/registry/pull/783)
* Disabled spellcheck for browsers to cleanup UI [#759](https://github.com/internetee/registry/issues/759)
* Admin: refactored registrar management [#770](https://github.com/internetee/registry/pull/770)
* Fix structure.sql [#796](https://github.com/internetee/registry/pull/796)
19.03.2018
* EPP transfer and REPP bulk transfer reuses contact objects [#746](https://github.com/internetee/registry/issues/746)
* Gems: Rack (1.6.9) and Rack-protection (1.5.5) update [#768](https://github.com/internetee/registry/issues/768)

View file

@ -18,7 +18,7 @@ class Epp::Domain < Domain
after_validation :validate_contacts
def validate_contacts
return true if is_renewal || is_transfer
return true if is_transfer
ok = true
active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? }

View file

@ -1,7 +1,31 @@
cash:
duration: 1 year
price_cents: 500
create_one_month:
duration: 1 month
price_cents: 100
operation_category: create
valid_from: 2010-07-05
valid_to: 2010-07-05
zone: test
renew_one_month:
duration: 1 month
price_cents: 100
operation_category: renew
valid_from: 2010-07-05
valid_to: 2010-07-05
zone: test
create_one_year:
duration: 1 year
price_cents: 1000
operation_category: create
valid_from: 2010-07-05
valid_to: 2010-07-05
zone: test
renew_one_year:
duration: 1 year
price_cents: 1000
operation_category: renew
valid_from: 2010-07-05
valid_to: 2010-07-05
zone: test

View file

@ -40,7 +40,7 @@ metro:
invalid:
name: invalid.test
transfer_code: any
valid_to: 2010-07-05
transfer_code: 1438d6
valid_to: <%= Time.zone.parse('2010-07-05').utc.to_s(:db) %>
registrar: bestnames
registrant: invalid

View file

@ -0,0 +1,32 @@
require 'test_helper'
class EppDomainRenewTest < ActionDispatch::IntegrationTest
self.use_transactional_fixtures = false
def setup
travel_to Time.zone.parse('2010-07-05')
end
def test_domain_cannot_be_renewed_when_invalid
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>
<renew>
<domain:renew xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>invalid.test</domain:name>
<domain:curExpDate>2010-07-05</domain:curExpDate>
<domain:period unit="m">1</domain:period>
</domain:renew>
</renew>
</command>
</epp>
XML
assert_no_changes -> { domains(:invalid).valid_to } do
post '/epp/command/renew', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
end
assert_equal '2304', Nokogiri::XML(response.body).at_css('result')[:code],
Nokogiri::XML(response.body).css('result').text
end
end

View file

@ -9,7 +9,7 @@ class RegistrarDomainsTest < ActionDispatch::IntegrationTest
Domain,Transfer code,Registrant name,Registrant code,Date of expiry
library.test,45118f5,Acme Ltd,acme-ltd-001,2010-07-05
shop.test,65078d5,John,john-001,2010-07-05
invalid.test,any,any,any,2010-07-05
invalid.test,1438d6,any,any,2010-07-05
airport.test,55438j5,John,john-001,2010-07-05
CSV

View file

@ -0,0 +1,94 @@
module ActiveSupport
module Testing
module Assertions
UNTRACKED = Object.new # :nodoc:
# Assertion that the result of evaluating an expression is changed before
# and after invoking the passed in block.
#
# assert_changes 'Status.all_good?' do
# post :create, params: { status: { ok: false } }
# end
#
# You can pass the block as a string to be evaluated in the context of
# the block. A lambda can be passed for the block as well.
#
# assert_changes -> { Status.all_good? } do
# post :create, params: { status: { ok: false } }
# end
#
# The assertion is useful to test side effects. The passed block can be
# anything that can be converted to string with #to_s.
#
# assert_changes :@object do
# @object = 42
# end
#
# The keyword arguments :from and :to can be given to specify the
# expected initial value and the expected value after the block was
# executed.
#
# assert_changes :@object, from: nil, to: :foo do
# @object = :foo
# end
#
# An error message can be specified.
#
# assert_changes -> { Status.all_good? }, 'Expected the status to be bad' do
# post :create, params: { status: { incident: true } }
# end
def assert_changes(expression, message = nil, from: UNTRACKED, to: UNTRACKED, &block)
exp = expression.respond_to?(:call) ? expression : -> { eval(expression.to_s, block.binding) }
before = exp.call
retval = yield
unless from == UNTRACKED
error = "#{expression.inspect} isn't #{from.inspect}"
error = "#{message}.\n#{error}" if message
assert from === before, error
end
after = exp.call
if to == UNTRACKED
error = "#{expression.inspect} didn't changed"
error = "#{message}.\n#{error}" if message
assert_not_equal before, after, error
else
error = "#{expression.inspect} didn't change to #{to}"
error = "#{message}.\n#{error}" if message
assert to === after, error
end
retval
end
# Assertion that the result of evaluating an expression is changed before
# and after invoking the passed in block.
#
# assert_no_changes 'Status.all_good?' do
# post :create, params: { status: { ok: true } }
# end
#
# An error message can be specified.
#
# assert_no_changes -> { Status.all_good? }, 'Expected the status to be good' do
# post :create, params: { status: { ok: false } }
# end
def assert_no_changes(expression, message = nil, &block)
exp = expression.respond_to?(:call) ? expression : -> { eval(expression.to_s, block.binding) }
before = exp.call
retval = yield
after = exp.call
error = "#{expression.inspect} did change to #{after}"
error = "#{message}.\n#{error}" if message
assert_equal before, after, error
retval
end
end
end
end

View file

@ -11,6 +11,7 @@ require 'minitest/mock'
require 'capybara/rails'
require 'capybara/minitest'
require 'webmock/minitest'
require 'support/rails5_assetions' # Remove once upgraded to Rails 5
Setting.address_processing = false
Setting.registry_country_code = 'US'