diff --git a/CHANGELOG.md b/CHANGELOG.md
index f6a9ff66a..e8045349b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+14.08.2020
+* Added handling of second lvl zoness managed by the registry in whois records [#1661](https://github.com/internetee/registry/issues/1661)
+
+13.08.2020
+* Removed keystore gem and replaced LHV JKS with PKCS12 [#1645](https://github.com/internetee/registry/issues/1645)
+
+11.08.2020
+* Fixed postal address saving bug with disabled address processing [#1650](https://github.com/internetee/registry/issues/1650)
+
07.08.2020
* Restored creator and updator strings to contacts and related object records [#1636](https://github.com/internetee/registry/issues/1636)
* Security gem updates: sdoc to 1.1 and json to 2.3.1 [#1657](https://github.com/internetee/registry/pull/1657)
diff --git a/Gemfile b/Gemfile
index 1376d3638..12b826e3c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -65,7 +65,7 @@ gem 'airbrake'
gem 'company_register', github: 'internetee/company_register', branch: :master
gem 'e_invoice', github: 'internetee/e_invoice', branch: :master
-gem 'lhv', github: 'internetee/lhv', branch: :master
+gem 'lhv', github: 'internetee/lhv', branch: 'master'
gem 'domain_name'
gem 'haml', '~> 5.0'
gem 'wkhtmltopdf-binary', '~> 0.12.5.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index a2744cc49..f7eb6cf2a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -45,11 +45,10 @@ GIT
GIT
remote: https://github.com/internetee/lhv.git
- revision: c53dd82393f8a81f6e9da793ae0474294ef88762
+ revision: 1825240b3bf8b262418cc6c8ef7ed1aba386dd7d
branch: master
specs:
lhv (0.1.0)
- keystores
logger
nokogiri
@@ -266,7 +265,6 @@ GEM
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
- keystores (0.4.0)
libxml-ruby (3.2.0)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
diff --git a/app/jobs/regenerate_subzone_whoises_job.rb b/app/jobs/regenerate_subzone_whoises_job.rb
new file mode 100644
index 000000000..280fa4088
--- /dev/null
+++ b/app/jobs/regenerate_subzone_whoises_job.rb
@@ -0,0 +1,11 @@
+class RegenerateSubzoneWhoisesJob < Que::Job
+ def run
+ subzones = DNS::Zone.all
+
+ subzones.each do |zone|
+ next unless zone.subzone?
+
+ UpdateWhoisRecordJob.enqueue zone.origin, 'zone'
+ end
+ end
+end
diff --git a/app/jobs/update_whois_record_job.rb b/app/jobs/update_whois_record_job.rb
index 16f4e0e79..2973d5a6b 100644
--- a/app/jobs/update_whois_record_job.rb
+++ b/app/jobs/update_whois_record_job.rb
@@ -3,15 +3,10 @@ class UpdateWhoisRecordJob < Que::Job
def run(names, type)
::PaperTrail.request.whodunnit = "job - #{self.class.name} - #{type}"
- klass = case type
- when 'reserved' then ReservedDomain
- when 'blocked' then BlockedDomain
- when 'domain' then Domain
- when 'disputed' then Dispute.active
- end
+ klass = determine_class(type)
Array(names).each do |name|
- record = klass.find_by(name: name)
+ record = find_record(klass, name)
if record
send "update_#{type}", record
else
@@ -20,6 +15,20 @@ class UpdateWhoisRecordJob < Que::Job
end
end
+ def find_record(klass, name)
+ klass == DNS::Zone ? klass.find_by(origin: name) : klass.find_by(name: name)
+ end
+
+ def determine_class(type)
+ case type
+ when 'reserved' then ReservedDomain
+ when 'blocked' then BlockedDomain
+ when 'domain' then Domain
+ when 'disputed' then Dispute.active
+ when 'zone' then DNS::Zone
+ end
+ end
+
def update_domain(domain)
domain.whois_record ? domain.whois_record.save : domain.create_whois_record
end
@@ -36,6 +45,10 @@ class UpdateWhoisRecordJob < Que::Job
update_reserved(record)
end
+ def update_zone(record)
+ update_reserved(record)
+ end
+
# 1. deleting own
# 2. trying to regenerate reserved in order domain is still in the list
def delete_domain(name)
@@ -60,6 +73,11 @@ class UpdateWhoisRecordJob < Que::Job
remove_status_from_whois(domain_name: name, domain_status: 'disputed')
end
+ def delete_zone(name)
+ WhoisRecord.where(name: name).destroy_all
+ Whois::Record.where(name: name).destroy_all
+ end
+
def remove_status_from_whois(domain_name:, domain_status:)
Whois::Record.where(name: domain_name).each do |r|
r.json['status'] = r.json['status'].delete_if { |status| status == domain_status }
diff --git a/app/models/actions/contact_update.rb b/app/models/actions/contact_update.rb
index 5b94cf918..f8b39ecb4 100644
--- a/app/models/actions/contact_update.rb
+++ b/app/models/actions/contact_update.rb
@@ -23,7 +23,7 @@ module Actions
end
def maybe_remove_address
- return if Setting.address_processing?
+ return if Contact.address_processing?
new_attributes.delete(:city)
new_attributes.delete(:zip)
diff --git a/app/models/concerns/zone/whois_queryable.rb b/app/models/concerns/zone/whois_queryable.rb
new file mode 100644
index 000000000..2c453dbef
--- /dev/null
+++ b/app/models/concerns/zone/whois_queryable.rb
@@ -0,0 +1,72 @@
+module Concerns
+ module Zone
+ module WhoisQueryable
+ extend ActiveSupport::Concern
+
+ included do
+ after_save :update_whois_record, if: :subzone?
+ after_destroy :update_whois_record
+ end
+
+ def subzone?
+ origin.include? '.'
+ end
+
+ def update_whois_record
+ UpdateWhoisRecordJob.enqueue origin, 'zone'
+ end
+
+ def generate_data
+ wr = Whois::Record.find_or_initialize_by(name: origin)
+ wr.json = generate_json
+ wr.save
+ end
+
+ def generate_json
+ data = {}.with_indifferent_access
+ [domain_vars, registrar_vars, registrant_vars].each do |h|
+ data.merge!(h)
+ end
+
+ data
+ end
+
+ def domain_vars
+ { disclaimer: Setting.registry_whois_disclaimer, name: origin,
+ registered: created_at.try(:to_s, :iso8601), status: ['ok (paid and in zone)'],
+ changed: updated_at.try(:to_s, :iso8601), email: Setting.registry_email,
+ admin_contacts: [contact_vars], tech_contacts: [contact_vars],
+ nameservers: nameserver_vars }
+ end
+
+ def registrar_vars
+ { registrar: Setting.registry_juridical_name, registrar_website: Setting.registry_url,
+ registrar_phone: Setting.registry_phone }
+ end
+
+ def registrant_vars
+ { registrant: Setting.registry_juridical_name, registrant_reg_no: Setting.registry_reg_no,
+ registrant_ident_country_code: Setting.registry_country_code, registrant_kind: 'org',
+ registrant_disclosed_attributes: %w[name email] }
+ end
+
+ def contact_vars
+ { name: Setting.registry_invoice_contact, email: Setting.registry_email,
+ disclosed_attributes: %w[name email] }
+ end
+
+ def nameserver_vars
+ vars = []
+ return vars unless ns_records
+
+ parsed_ns = ns_records.gsub("\r", '').gsub("\n", '')
+ parsed_ns.split("#{origin}. IN NS ").each do |ns|
+ ns.delete_suffix! '.'
+ vars << ns if ns.match? Nameserver::HOSTNAME_REGEXP
+ end
+
+ vars
+ end
+ end
+ end
+end
diff --git a/app/models/contact.rb b/app/models/contact.rb
index ac64b059f..4199e6dc7 100644
--- a/app/models/contact.rb
+++ b/app/models/contact.rb
@@ -62,6 +62,7 @@ class Contact < ApplicationRecord
mapping: [%w[ident code], %w[ident_type type], %w[ident_country_code country_code]]
after_save :update_related_whois_records
+ before_validation :clear_address_modifications, if: -> { !self.class.address_processing? }
self.ignored_columns = %w[legacy_id legacy_history_id]
@@ -507,6 +508,19 @@ class Contact < ApplicationRecord
]).present?
end
+ def clear_address_modifications
+ return unless modifies_address?
+
+ remove_address
+ end
+
+ def modifies_address?
+ modified = false
+ self.class.address_attribute_names.each { |field| modified = true if changes.key?(field) }
+
+ modified
+ end
+
def update_related_whois_records
# not doing anything if no real changes
ignored_columns = %w[updated_at created_at statuses status_notes]
diff --git a/app/models/dns/zone.rb b/app/models/dns/zone.rb
index a641c4e49..31749d952 100644
--- a/app/models/dns/zone.rb
+++ b/app/models/dns/zone.rb
@@ -1,8 +1,11 @@
+# frozen_string_literal: true
+
module DNS
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
+ include Concerns::Zone::WhoisQueryable
before_destroy do
throw(:abort) if used?
diff --git a/app/models/epp/response/result/code.rb b/app/models/epp/response/result/code.rb
index 2a65f6747..1be4a3f7c 100644
--- a/app/models/epp/response/result/code.rb
+++ b/app/models/epp/response/result/code.rb
@@ -7,6 +7,7 @@ module Epp
KEY_TO_VALUE = {
completed_successfully: 1000,
completed_successfully_action_pending: 1001,
+ completed_without_address: 1100,
completed_successfully_no_messages: 1300,
completed_successfully_ack_to_dequeue: 1301,
completed_successfully_ending_session: 1500,
@@ -35,6 +36,7 @@ module Epp
DEFAULT_DESCRIPTIONS = {
1000 => 'Command completed successfully',
1001 => 'Command completed successfully; action pending',
+ 1100 => 'Command completed successfully; Postal address data discarded',
1300 => 'Command completed successfully; no messages',
1301 => 'Command completed successfully; ack to dequeue',
1500 => 'Command completed successfully; ending session',
diff --git a/config/application.yml.sample b/config/application.yml.sample
index 8f71d75d8..2cd19b768 100644
--- a/config/application.yml.sample
+++ b/config/application.yml.sample
@@ -148,9 +148,8 @@ action_mailer_default_port: # default: no port (80)
action_mailer_default_from: # no-reply@example.com
action_mailer_force_delete_from: # `From` header for `DomainDeleteMailer#forced` email
-lhv_keystore:
+lhv_p12_keystore:
lhv_keystore_password:
-lhv_keystore_alias:
lhv_ca_file: # Needed only in dev mode
lhv_dev_mode: 'false'
@@ -163,9 +162,8 @@ test:
action_mailer_default_host: 'registry.test'
action_mailer_default_from: 'no-reply@registry.test'
action_mailer_force_delete_from: 'legal@registry.test'
- lhv_keystore: 'test/fixtures/files/keystore.jks'
+ lhv_p12_keystore: 'test/fixtures/files/keystore.p12'
lhv_keystore_password: 'testtest'
- lhv_keystore_alias: 'testtest'
legal_documents_dir: 'test/fixtures/files'
# Airbrake // Errbit:
diff --git a/lib/tasks/dev/create_bank_transactions/create_bank_transactions.rake b/lib/tasks/dev/create_bank_transactions/create_bank_transactions.rake
index 33614d049..17b7586e2 100644
--- a/lib/tasks/dev/create_bank_transactions/create_bank_transactions.rake
+++ b/lib/tasks/dev/create_bank_transactions/create_bank_transactions.rake
@@ -3,12 +3,9 @@ namespace :dev do
remitter_iban = ENV['remitter_iban']
beneficiary_iban = Setting.registry_iban
- keystore_password = ENV['lhv_keystore_password']
- keystore_alias = ENV['lhv_keystore_alias']
- keystore = Keystores::JavaKeystore.new
- keystore.load(ENV['lhv_keystore'], keystore_password)
- cert = keystore.get_certificate(keystore_alias)
- key = keystore.get_key(keystore_alias, keystore_password)
+ keystore = OpenSSL::PKCS12.new(File.read(ENV['lhv_p12_keystore']), ENV['lhv_keystore_password'])
+ key = keystore.key
+ cert = keystore.certificate
api_base_uri = URI.parse('https://testconnect.lhv.eu/connect-prelive')
request_headers = { 'content-type' => 'application/xml' }
@@ -38,4 +35,4 @@ namespace :dev do
end
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/invoices/process_payments.rake b/lib/tasks/invoices/process_payments.rake
index 6e4c57213..340aba187 100644
--- a/lib/tasks/invoices/process_payments.rake
+++ b/lib/tasks/invoices/process_payments.rake
@@ -2,12 +2,9 @@ namespace :invoices do
task process_payments: :environment do
registry_bank_account_iban = Setting.registry_iban
- keystore_password = ENV['lhv_keystore_password']
- keystore_alias = ENV['lhv_keystore_alias']
- keystore = Keystores::JavaKeystore.new
- keystore.load(ENV['lhv_keystore'], keystore_password)
- cert = keystore.get_certificate(keystore_alias)
- key = keystore.get_key(keystore_alias, keystore_password)
+ keystore = OpenSSL::PKCS12.new(File.read(ENV['lhv_p12_keystore']), ENV['lhv_keystore_password'])
+ key = keystore.key
+ cert = keystore.certificate
api = Lhv::ConnectApi.new
api.cert = cert
@@ -46,4 +43,4 @@ namespace :invoices do
puts "Transactions processed: #{incoming_transactions.size}"
end
-end
\ No newline at end of file
+end
diff --git a/test/fixtures/files/keystore.jks b/test/fixtures/files/keystore.jks
deleted file mode 100644
index 7ce34f308..000000000
Binary files a/test/fixtures/files/keystore.jks and /dev/null differ
diff --git a/test/fixtures/files/keystore.p12 b/test/fixtures/files/keystore.p12
new file mode 100644
index 000000000..962ddede2
Binary files /dev/null and b/test/fixtures/files/keystore.p12 differ
diff --git a/test/integration/api/v1/registrant/contacts/update_test.rb b/test/integration/api/v1/registrant/contacts/update_test.rb
index 6e0c0eea3..e2e9abe9a 100644
--- a/test/integration/api/v1/registrant/contacts/update_test.rb
+++ b/test/integration/api/v1/registrant/contacts/update_test.rb
@@ -91,8 +91,8 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
end
def test_address_is_optional_when_enabled
- @contact.update!(street: 'any', zip: 'any', city: 'any', state: 'any', country_code: 'US')
Setting.address_processing = true
+ @contact.update!(street: 'any', zip: 'any', city: 'any', state: 'any', country_code: 'US')
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'any' },
as: :json,
diff --git a/test/integration/epp/contact/create/base_test.rb b/test/integration/epp/contact/create/base_test.rb
index e9a59b8d2..262487a1e 100644
--- a/test/integration/epp/contact/create/base_test.rb
+++ b/test/integration/epp/contact/create/base_test.rb
@@ -140,4 +140,115 @@ class EppContactCreateBaseTest < EppTestCase
end
assert_epp_response :required_parameter_missing
end
+
+ def test_does_not_save_address_when_address_processing_turned_off
+ name = 'new'
+ email = 'new@registrar.test'
+ phone = '+1.2'
+
+ request_xml = <<-XML
+
+
+
+
+
+
+ #{name}
+
+ 123 Example
+ Tallinn
+ FFF
+ 123456
+ EE
+
+
+ #{phone}
+ #{email}
+
+
+
+
+ 123
+
+
+
+
+ XML
+
+ assert_difference 'Contact.count' do
+ post epp_create_path, params: { frame: request_xml },
+ headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ end
+
+ assert_epp_response :completed_without_address
+ contact = Contact.find_by(name: name)
+ assert_equal name, contact.name
+ assert_equal email, contact.email
+ assert_equal phone, contact.phone
+ assert_not_empty contact.code
+ assert_nil contact.city
+ assert_nil contact.street
+ assert_nil contact.zip
+ assert_nil contact.country_code
+ assert_nil contact.state
+ end
+
+ def test_saves_address_when_address_processing_turned_on
+ Setting.address_processing = true
+
+ name = 'new'
+ email = 'new@registrar.test'
+ phone = '+1.2'
+ street = '123 Example'
+ city = 'Tallinn'
+ state = 'Harjumaa'
+ zip = '123456'
+ country_code = 'EE'
+
+ request_xml = <<-XML
+
+
+
+
+
+
+ #{name}
+
+ #{street}
+ #{city}
+ #{state}
+ #{zip}
+ #{country_code}
+
+
+ #{phone}
+ #{email}
+
+
+
+
+ 123
+
+
+
+
+ XML
+
+ assert_difference 'Contact.count' do
+ post epp_create_path, params: { frame: request_xml },
+ headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ end
+
+ assert_epp_response :completed_successfully
+ contact = Contact.find_by(name: name)
+ assert_equal name, contact.name
+ assert_equal email, contact.email
+ assert_equal phone, contact.phone
+ assert_not_empty contact.code
+ assert_equal city, contact.city
+ assert_equal street, contact.street
+ assert_equal zip, contact.zip
+ assert_equal country_code, contact.country_code
+ assert_equal state, contact.state
+ end
end
diff --git a/test/integration/epp/contact/update/base_test.rb b/test/integration/epp/contact/update/base_test.rb
index 3d332711f..98c0e4462 100644
--- a/test/integration/epp/contact/update/base_test.rb
+++ b/test/integration/epp/contact/update/base_test.rb
@@ -232,6 +232,99 @@ class EppContactUpdateBaseTest < EppTestCase
assert_epp_response :completed_successfully
end
+ def test_updates_address_when_address_processing_turned_on
+ @contact.update_columns(code: @contact.code.upcase)
+ Setting.address_processing = true
+
+ street = '123 Example'
+ city = 'Tallinn'
+ state = 'Harjumaa'
+ zip = '123456'
+ country_code = 'EE'
+
+ request_xml = <<-XML
+
+
+
+
+
+ #{@contact.code}
+
+
+
+ #{street}
+ #{city}
+ #{state}
+ #{zip}
+ #{country_code}
+
+
+
+
+
+
+
+ XML
+
+ post epp_update_path, params: { frame: request_xml },
+ headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
+
+ assert_epp_response :completed_successfully
+ @contact.reload
+
+ assert_equal city, @contact.city
+ assert_equal street, @contact.street
+ assert_equal zip, @contact.zip
+ assert_equal country_code, @contact.country_code
+ assert_equal state, @contact.state
+ end
+
+ def test_does_not_update_address_when_address_processing_turned_off
+ @contact.update_columns(code: @contact.code.upcase)
+
+ street = '123 Example'
+ city = 'Tallinn'
+ state = 'Harjumaa'
+ zip = '123456'
+ country_code = 'EE'
+
+ request_xml = <<-XML
+
+
+
+
+
+ #{@contact.code}
+
+
+
+ #{street}
+ #{city}
+ #{state}
+ #{zip}
+ #{country_code}
+
+
+
+
+
+
+
+ XML
+
+ post epp_update_path, params: { frame: request_xml },
+ headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
+
+ assert_epp_response :completed_without_address
+ @contact.reload
+
+ assert_nil @contact.city
+ assert_nil @contact.street
+ assert_nil @contact.zip
+ assert_nil @contact.country_code
+ assert_nil @contact.state
+ end
+
private
def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact)
diff --git a/test/jobs/regeneate_subzone_whoises_job_test.rb b/test/jobs/regeneate_subzone_whoises_job_test.rb
new file mode 100644
index 000000000..745c2392c
--- /dev/null
+++ b/test/jobs/regeneate_subzone_whoises_job_test.rb
@@ -0,0 +1,18 @@
+require 'test_helper'
+
+class RegenerateSubzoneWhoisesJobTest < ActiveSupport::TestCase
+ def test_regenerates_whois_data_only_for_subzones
+ subzone = dns_zones(:one).dup
+ subzone.origin = 'subzone.test'
+ subzone.save
+
+ Whois::Record.where(name: subzone.origin).destroy_all
+ Whois::Record.where(name: dns_zones(:one)).destroy_all
+ assert_nil Whois::Record.find_by(name: subzone.origin)
+ assert_nil Whois::Record.find_by(name: dns_zones(:one).origin)
+
+ RegenerateSubzoneWhoisesJob.run
+ assert Whois::Record.find_by(name: subzone.origin)
+ assert_nil Whois::Record.find_by(name: dns_zones(:one).origin)
+ end
+end
diff --git a/test/models/contact_test.rb b/test/models/contact_test.rb
index f833011c6..000333d57 100644
--- a/test/models/contact_test.rb
+++ b/test/models/contact_test.rb
@@ -152,6 +152,8 @@ class ContactTest < ActiveSupport::TestCase
end
def test_address
+ Setting.address_processing = true
+
address = Contact::Address.new('new street', '83746', 'new city', 'new state', 'EE')
@contact.address = address
@contact.save!
@@ -238,6 +240,7 @@ class ContactTest < ActiveSupport::TestCase
end
def test_normalizes_country_code
+ Setting.address_processing = true
contact = Contact.new(country_code: 'us')
contact.validate
assert_equal 'US', contact.country_code
diff --git a/test/models/dns/zone_test.rb b/test/models/dns/zone_test.rb
index c18f9592a..fab4c6355 100644
--- a/test/models/dns/zone_test.rb
+++ b/test/models/dns/zone_test.rb
@@ -124,6 +124,60 @@ class DNS::ZoneTest < ActiveSupport::TestCase
assert zone.invalid?
end
+ def test_determines_if_subzone
+ zone = valid_zone
+ zone.update(origin: 'pri.ee')
+ assert zone.subzone?
+ end
+
+ def test_updates_whois_after_update
+ subzone = dns_zones(:one).dup
+
+ subzone.origin = 'sub.zone'
+ subzone.save
+
+ whois_record = Whois::Record.find_by(name: subzone.origin)
+ assert whois_record.present?
+ end
+
+ def test_has_setting_info_as_contacts_for_subzones
+ subzone = dns_zones(:one).dup
+
+ subzone.origin = 'sub.zone'
+ subzone.save
+
+ whois_record = Whois::Record.find_by(name: subzone.origin)
+ assert whois_record.present?
+
+ assert_equal Setting.registry_whois_disclaimer, whois_record.json['disclaimer']
+ assert_equal Setting.registry_email, whois_record.json['email']
+ assert_equal Setting.registry_juridical_name, whois_record.json['registrar']
+ assert_equal Setting.registry_url, whois_record.json['registrar_website']
+ assert_equal Setting.registry_phone, whois_record.json['registrar_phone']
+
+ assert_equal Setting.registry_juridical_name, whois_record.json['registrant']
+ assert_equal Setting.registry_reg_no, whois_record.json['registrant_reg_no']
+ assert_equal Setting.registry_country_code, whois_record.json['registrant_ident_country_code']
+
+ contact = { name: Setting.registry_invoice_contact, email: Setting.registry_email,
+ disclosed_attributes: %w[name email] }.with_indifferent_access
+
+ assert_equal contact, whois_record.json['admin_contacts'][0]
+ assert_equal contact, whois_record.json['tech_contacts'][0]
+ end
+
+ def test_deletes_whois_record_after_destroy
+ subzone = dns_zones(:one).dup
+
+ subzone.origin = 'sub.zone'
+ subzone.save
+
+ assert Whois::Record.find_by(name: subzone.origin).present?
+
+ subzone.destroy
+ assert_nil Whois::Record.find_by(name: subzone.origin)
+ end
+
private
def valid_zone
diff --git a/test/models/epp/response/result/code_test.rb b/test/models/epp/response/result/code_test.rb
index 3c75303f1..f16013180 100644
--- a/test/models/epp/response/result/code_test.rb
+++ b/test/models/epp/response/result/code_test.rb
@@ -28,6 +28,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
codes = {
completed_successfully: 1000,
completed_successfully_action_pending: 1001,
+ completed_without_address: 1100,
completed_successfully_no_messages: 1300,
completed_successfully_ack_to_dequeue: 1301,
completed_successfully_ending_session: 1500,
@@ -58,6 +59,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
descriptions = {
1000 => 'Command completed successfully',
1001 => 'Command completed successfully; action pending',
+ 1100 => 'Command completed successfully; Postal address data discarded',
1300 => 'Command completed successfully; no messages',
1301 => 'Command completed successfully; ack to dequeue',
1500 => 'Command completed successfully; ending session',
diff --git a/test/tasks/invoices/process_payments_test.rb b/test/tasks/invoices/process_payments_test.rb
index 02855e9fa..bd447be29 100644
--- a/test/tasks/invoices/process_payments_test.rb
+++ b/test/tasks/invoices/process_payments_test.rb
@@ -88,6 +88,12 @@ class ProcessPaymentsTaskTest < ActiveSupport::TestCase
end
end
+ def test_parses_keystore_properly
+ assert_nothing_raised do
+ run_task
+ end
+ end
+
private
def run_task
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 7cd805684..aaa4452f3 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -44,6 +44,7 @@ class ActiveSupport::TestCase
teardown do
travel_back
+ Setting.address_processing = false
end
end
@@ -57,9 +58,14 @@ class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
WebMock.reset!
Capybara.reset_sessions!
Capybara.use_default_driver
+ Setting.address_processing = false
end
end
class EppTestCase < ActionDispatch::IntegrationTest
include Assertions::EppAssertions
+
+ teardown do
+ Setting.address_processing = false
+ end
end