From 74e3d5461b6a6df6f11df728f6effc6b89074058 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Thu, 20 May 2021 14:03:22 +0500 Subject: [PATCH 1/4] Add a way to get latest version of an xsd schema by prefix --- app/lib/xsd_util.rb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 app/lib/xsd_util.rb diff --git a/app/lib/xsd_util.rb b/app/lib/xsd_util.rb new file mode 100644 index 0000000000..99a648841a --- /dev/null +++ b/app/lib/xsd_util.rb @@ -0,0 +1,36 @@ +class XsdUtil + SCHEMA_PATH = 'lib/schemas/'.freeze + + def initialise(schema_path = SCHEMA_PATH) + @schema_path = schema_path + end + + def xsd_schemas + @xsd_schemas ||= Dir.entries(SCHEMA_PATH) + .select { |f| File.file? File.join(SCHEMA_PATH, f) } + end + + def basename(filename) + File.basename(filename, '.xsd') + end + + def prefix(filename) + regex = /([a-zA-Z]+-?[a-zA-Z]+)/ + + basename(filename).match(regex)[0] + end + + def prefixes + xsd_schemas.map { |filename| prefix(filename) }.uniq + end + + def schemas_by_name + prefixes.each_with_object({}) do |prefix, hash| + hash[prefix] = xsd_schemas.select { |filename| filename.include? prefix }.uniq.sort + end + end + + def latest(prefix) + schemas_by_name[prefix].last + end +end From 45dfa5752985724155e58c741e5a10976b80cedd Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Thu, 20 May 2021 17:06:34 +0500 Subject: [PATCH 2/4] Move class to lib, add sugar, add tests --- app/lib/xsd_util.rb | 36 -------------- config/initializers/xsd.rb | 2 + lib/application_service.rb | 5 ++ lib/xsd/util.rb | 48 +++++++++++++++++++ test/fixtures/files/schemas/abcde-1.1.xsd | 0 test/fixtures/files/schemas/abcde-1.2.xsd | 0 .../files/schemas/abcde-fghij-1.1.xsd | 0 .../files/schemas/abcde-fghij-1.2.xsd | 0 .../files/schemas/abcde-fghij-1.3.xsd | 0 test/lib/xsd_util/xsd_util_test.rb | 16 +++++++ 10 files changed, 71 insertions(+), 36 deletions(-) delete mode 100644 app/lib/xsd_util.rb create mode 100644 config/initializers/xsd.rb create mode 100644 lib/application_service.rb create mode 100644 lib/xsd/util.rb create mode 100644 test/fixtures/files/schemas/abcde-1.1.xsd create mode 100644 test/fixtures/files/schemas/abcde-1.2.xsd create mode 100644 test/fixtures/files/schemas/abcde-fghij-1.1.xsd create mode 100644 test/fixtures/files/schemas/abcde-fghij-1.2.xsd create mode 100644 test/fixtures/files/schemas/abcde-fghij-1.3.xsd create mode 100644 test/lib/xsd_util/xsd_util_test.rb diff --git a/app/lib/xsd_util.rb b/app/lib/xsd_util.rb deleted file mode 100644 index 99a648841a..0000000000 --- a/app/lib/xsd_util.rb +++ /dev/null @@ -1,36 +0,0 @@ -class XsdUtil - SCHEMA_PATH = 'lib/schemas/'.freeze - - def initialise(schema_path = SCHEMA_PATH) - @schema_path = schema_path - end - - def xsd_schemas - @xsd_schemas ||= Dir.entries(SCHEMA_PATH) - .select { |f| File.file? File.join(SCHEMA_PATH, f) } - end - - def basename(filename) - File.basename(filename, '.xsd') - end - - def prefix(filename) - regex = /([a-zA-Z]+-?[a-zA-Z]+)/ - - basename(filename).match(regex)[0] - end - - def prefixes - xsd_schemas.map { |filename| prefix(filename) }.uniq - end - - def schemas_by_name - prefixes.each_with_object({}) do |prefix, hash| - hash[prefix] = xsd_schemas.select { |filename| filename.include? prefix }.uniq.sort - end - end - - def latest(prefix) - schemas_by_name[prefix].last - end -end diff --git a/config/initializers/xsd.rb b/config/initializers/xsd.rb new file mode 100644 index 0000000000..a02fe2dae1 --- /dev/null +++ b/config/initializers/xsd.rb @@ -0,0 +1,2 @@ +require 'application_service' +require 'xsd/util' diff --git a/lib/application_service.rb b/lib/application_service.rb new file mode 100644 index 0000000000..6185f03147 --- /dev/null +++ b/lib/application_service.rb @@ -0,0 +1,5 @@ +class ApplicationService + def self.call(*args, &block) + new(*args, &block).call + end +end diff --git a/lib/xsd/util.rb b/lib/xsd/util.rb new file mode 100644 index 0000000000..196175cbee --- /dev/null +++ b/lib/xsd/util.rb @@ -0,0 +1,48 @@ +module Xsd + class Util < ApplicationService + SCHEMA_PATH = 'lib/schemas/'.freeze + + attr_reader :xsd_schemas, :for_prefix + + def initialize(params) + schema_path = params.fetch(:schema_path, SCHEMA_PATH) + @for_prefix = params.fetch(:for_prefix) + @xsd_schemas = Dir.entries(schema_path).select { |f| File.file? File.join(schema_path, f) } + end + + def call + latest(for_prefix) + end + + private + + def latest(prefix) + schemas_by_name[prefix].last + end + + def basename(filename) + File.basename(filename, '.xsd') + end + + def prefix(filename) + regex = /([a-zA-Z]+-?[a-zA-Z]+)/ + + basename(filename).match(regex)[0] + end + + def prefixes + xsd_schemas.map { |filename| prefix(filename) }.uniq + end + + def schemas_by_name + prefixes.each_with_object({}) do |prefix, hash| + hash[prefix] = xsd_schemas.select { |filename| prefix_check(prefix, filename) }.uniq.sort + end + end + + def prefix_check(prefix, filename) + version_regex = /\-\d+\S\d+/ + (filename.include? prefix) && (filename.sub(prefix, '')[0, 4] =~ version_regex) + end + end +end diff --git a/test/fixtures/files/schemas/abcde-1.1.xsd b/test/fixtures/files/schemas/abcde-1.1.xsd new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fixtures/files/schemas/abcde-1.2.xsd b/test/fixtures/files/schemas/abcde-1.2.xsd new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fixtures/files/schemas/abcde-fghij-1.1.xsd b/test/fixtures/files/schemas/abcde-fghij-1.1.xsd new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fixtures/files/schemas/abcde-fghij-1.2.xsd b/test/fixtures/files/schemas/abcde-fghij-1.2.xsd new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fixtures/files/schemas/abcde-fghij-1.3.xsd b/test/fixtures/files/schemas/abcde-fghij-1.3.xsd new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/lib/xsd_util/xsd_util_test.rb b/test/lib/xsd_util/xsd_util_test.rb new file mode 100644 index 0000000000..d2d70a68f8 --- /dev/null +++ b/test/lib/xsd_util/xsd_util_test.rb @@ -0,0 +1,16 @@ +require 'test_helper' +require 'xsd/util' + +class XsdUtilTest < ActiveSupport::TestCase + def test_single_part_name + version = Xsd::Util.call(schema_path: 'test/fixtures/files/schemas', for_prefix: 'abcde') + + assert_equal 'abcde-1.2.xsd', version + end + + def test_double_part_name + version = Xsd::Util.call(schema_path: 'test/fixtures/files/schemas', for_prefix: 'abcde-fghij') + + assert_equal 'abcde-fghij-1.3.xsd', version + end +end From a0d0ce3e0024c24e03693e0370c0b791f3cf76e6 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Fri, 21 May 2021 11:45:22 +0500 Subject: [PATCH 3/4] Rename util class, add first usage --- config/initializers/xsd.rb | 2 +- lib/xsd/{util.rb => schema.rb} | 10 +++++++-- .../epp/domain/create/base_test.rb | 6 +++--- test/lib/xsd_schema/xsd_schema_test.rb | 21 +++++++++++++++++++ test/lib/xsd_util/xsd_util_test.rb | 16 -------------- 5 files changed, 33 insertions(+), 22 deletions(-) rename lib/xsd/{util.rb => schema.rb} (82%) create mode 100644 test/lib/xsd_schema/xsd_schema_test.rb delete mode 100644 test/lib/xsd_util/xsd_util_test.rb diff --git a/config/initializers/xsd.rb b/config/initializers/xsd.rb index a02fe2dae1..12a8af78a4 100644 --- a/config/initializers/xsd.rb +++ b/config/initializers/xsd.rb @@ -1,2 +1,2 @@ require 'application_service' -require 'xsd/util' +require 'xsd/schema' diff --git a/lib/xsd/util.rb b/lib/xsd/schema.rb similarity index 82% rename from lib/xsd/util.rb rename to lib/xsd/schema.rb index 196175cbee..12a0cd6d94 100644 --- a/lib/xsd/util.rb +++ b/lib/xsd/schema.rb @@ -1,6 +1,7 @@ module Xsd - class Util < ApplicationService + class Schema < ApplicationService SCHEMA_PATH = 'lib/schemas/'.freeze + BASE_URL = 'https://epp.tld.ee/schema/'.freeze attr_reader :xsd_schemas, :for_prefix @@ -10,8 +11,13 @@ def initialize(params) @xsd_schemas = Dir.entries(schema_path).select { |f| File.file? File.join(schema_path, f) } end + def self.filename(*args, &block) + new(*args, &block).call + end + def call - latest(for_prefix) + filename = latest(for_prefix) + BASE_URL + filename end private diff --git a/test/integration/epp/domain/create/base_test.rb b/test/integration/epp/domain/create/base_test.rb index 59a8ddf776..b8fd851be5 100644 --- a/test/integration/epp/domain/create/base_test.rb +++ b/test/integration/epp/domain/create/base_test.rb @@ -14,10 +14,10 @@ def test_illegal_chars_in_dns_key request_xml = <<-XML - + - + #{name} #{registrant.code} @@ -31,7 +31,7 @@ def test_illegal_chars_in_dns_key #{pub_key} - + #{'test' * 2000} diff --git a/test/lib/xsd_schema/xsd_schema_test.rb b/test/lib/xsd_schema/xsd_schema_test.rb new file mode 100644 index 0000000000..0d3e30103b --- /dev/null +++ b/test/lib/xsd_schema/xsd_schema_test.rb @@ -0,0 +1,21 @@ +require 'test_helper' +require 'xsd/schema' + +class XsdSchemaTest < ActiveSupport::TestCase + def setup + @schema_path = 'test/fixtures/files/schemas' + super + end + + def test_single_part_name + filename = Xsd::Schema.filename(schema_path: @schema_path, for_prefix: 'abcde') + + assert_equal Xsd::Schema::BASE_URL + 'abcde-1.2.xsd', filename + end + + def test_double_part_name + filename = Xsd::Schema.filename(schema_path: @schema_path, for_prefix: 'abcde-fghij') + + assert_equal Xsd::Schema::BASE_URL + 'abcde-fghij-1.3.xsd', filename + end +end diff --git a/test/lib/xsd_util/xsd_util_test.rb b/test/lib/xsd_util/xsd_util_test.rb deleted file mode 100644 index d2d70a68f8..0000000000 --- a/test/lib/xsd_util/xsd_util_test.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'test_helper' -require 'xsd/util' - -class XsdUtilTest < ActiveSupport::TestCase - def test_single_part_name - version = Xsd::Util.call(schema_path: 'test/fixtures/files/schemas', for_prefix: 'abcde') - - assert_equal 'abcde-1.2.xsd', version - end - - def test_double_part_name - version = Xsd::Util.call(schema_path: 'test/fixtures/files/schemas', for_prefix: 'abcde-fghij') - - assert_equal 'abcde-fghij-1.3.xsd', version - end -end From 00a0be23416c8ba5727eff3df80598d574734efd Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Fri, 21 May 2021 15:14:31 +0500 Subject: [PATCH 4/4] Replace some hardcoded schema paths for method calls --- app/views/epp/contacts/check.xml.builder | 2 +- app/views/epp/contacts/info.xml.builder | 4 +- app/views/epp/contacts/save.xml.builder | 2 +- app/views/epp/domains/check.xml.builder | 2 +- app/views/epp/domains/create.xml.builder | 2 +- app/views/epp/domains/info.xml.builder | 2 +- .../domains/partials/_transfer.xml.builder | 2 +- app/views/epp/domains/renew.xml.builder | 2 +- app/views/epp/error.xml.builder | 3 +- app/views/epp/poll/_action.xml.builder | 4 +- app/views/epp/poll/poll_req.xml.builder | 2 +- app/views/epp/sessions/greeting.xml.builder | 6 +- .../epp_requests/contact/check.xml | 4 +- .../epp_requests/contact/check_multiple.xml | 4 +- .../epp_requests/contact/create.xml | 6 +- .../epp_requests/contact/delete.xml | 6 +- .../epp_requests/contact/info.xml | 4 +- .../epp_requests/contact/update_chg.xml | 6 +- .../epp_requests/domain/check.xml | 4 +- .../epp_requests/domain/client_hold.xml | 4 +- .../epp_requests/domain/create.xml | 6 +- .../epp_requests/domain/delete.xml | 6 +- .../xml_consoles/epp_requests/domain/info.xml | 4 +- .../epp_requests/domain/renew.xml | 4 +- .../epp_requests/domain/transfer.xml | 6 +- .../epp_requests/domain/update.xml | 6 +- .../xml_consoles/epp_requests/poll/poll.xml | 2 +- lib/epp_constraint.rb | 6 +- lib/gem_monkey_patches/builder.rb | 2 +- .../admin_area/domain_update_confirms_test.rb | 16 +-- test/integration/admin_area/epp_logs_test.rb | 6 +- test/integration/epp/base_test.rb | 22 ++-- test/integration/epp/contact/base_test.rb | 4 +- .../epp/contact/check/base_test.rb | 26 ++-- .../epp/contact/create/base_test.rb | 36 +++--- .../epp/contact/delete/base_test.rb | 16 +-- .../integration/epp/contact/info/base_test.rb | 18 +-- .../epp/contact/transfer/base_test.rb | 4 +- .../epp/contact/update/base_test.rb | 52 ++++---- test/integration/epp/domain/base_test.rb | 4 +- .../epp/domain/check/auction_test.rb | 40 +++--- .../integration/epp/domain/check/base_test.rb | 60 ++++----- .../epp/domain/create/auction_idn_test.rb | 36 +++--- .../epp/domain/create/auction_test.rb | 42 +++--- .../epp/domain/create/base_test.rb | 120 +++++++++--------- .../epp/domain/delete/base_test.rb | 46 +++---- test/integration/epp/domain/info/base_test.rb | 38 +++--- .../integration/epp/domain/renew/base_test.rb | 32 ++--- .../epp/domain/transfer/query_test.rb | 16 +-- .../epp/domain/transfer/request_test.rb | 18 +-- .../epp/domain/update/base_test.rb | 102 +++++++-------- test/integration/epp/hello_test.rb | 2 +- test/integration/epp/login_test.rb | 30 ++--- test/integration/epp/logout_test.rb | 2 +- test/integration/epp/poll_test.rb | 18 +-- test/lib/deserializers/xml/contact_test.rb | 14 +- test/lib/deserializers/xml/ident_test.rb | 16 +-- .../deserializers/xml/legal_document_test.rb | 10 +- test/models/epp/response_test.rb | 2 +- 59 files changed, 481 insertions(+), 480 deletions(-) diff --git a/app/views/epp/contacts/check.xml.builder b/app/views/epp/contacts/check.xml.builder index e5ceee07a5..8e265b02fe 100644 --- a/app/views/epp/contacts/check.xml.builder +++ b/app/views/epp/contacts/check.xml.builder @@ -5,7 +5,7 @@ xml.epp_head do end xml.resData do - xml.tag!('contact:chkData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-ee-1.1.xsd') do + xml.tag!('contact:chkData', 'xmlns:contact' => Xsd::Schema.filename(for_prefix: 'contact-ee')) do @results.each do |result| xml.tag!('contact:cd') do xml.tag! "contact:id", result[:code], avail: result[:avail] diff --git a/app/views/epp/contacts/info.xml.builder b/app/views/epp/contacts/info.xml.builder index 6ce0a17f41..7067ed1e99 100644 --- a/app/views/epp/contacts/info.xml.builder +++ b/app/views/epp/contacts/info.xml.builder @@ -5,7 +5,7 @@ xml.epp_head do end xml.resData do - xml.tag!('contact:infData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-ee-1.1.xsd') do + xml.tag!('contact:infData', 'xmlns:contact' => Xsd::Schema.filename(for_prefix: 'contact-ee')) do xml.tag!('contact:id', @contact.code) xml.tag!('contact:roid', @contact.roid) @@ -78,7 +78,7 @@ xml.epp_head do end if can? :view_full_info, @contact, @password xml.tag!('extension') do - xml.tag!('eis:extdata', 'xmlns:eis' => 'https://epp.tld.ee/schema/eis-1.0.xsd') do + xml.tag!('eis:extdata', 'xmlns:eis' => Xsd::Schema.filename(for_prefix: 'eis')) do xml.tag!('eis:ident', @contact.ident, type: @contact.ident_type, cc: @contact.ident_country_code) end diff --git a/app/views/epp/contacts/save.xml.builder b/app/views/epp/contacts/save.xml.builder index 5e8a6cd378..2fd3737e30 100644 --- a/app/views/epp/contacts/save.xml.builder +++ b/app/views/epp/contacts/save.xml.builder @@ -5,7 +5,7 @@ xml.epp_head do end xml.resData do - xml.tag!('contact:creData', 'xmlns:contact' => 'https://epp.tld.ee/schema/contact-ee-1.1.xsd') do + xml.tag!('contact:creData', 'xmlns:contact' => Xsd::Schema.filename(for_prefix: 'contact-ee')) do xml.tag!('contact:id', @contact.code) xml.tag!('contact:crDate', @contact.created_at.try(:iso8601)) end diff --git a/app/views/epp/domains/check.xml.builder b/app/views/epp/domains/check.xml.builder index 903cee7696..f6f2fe8314 100644 --- a/app/views/epp/domains/check.xml.builder +++ b/app/views/epp/domains/check.xml.builder @@ -5,7 +5,7 @@ xml.epp_head do end xml.resData do - xml.tag!('domain:chkData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do + xml.tag!('domain:chkData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis')) do @domains.each do |x| xml.tag!('domain:cd') do xml.tag!('domain:name', x[:name], 'avail' => x[:avail]) diff --git a/app/views/epp/domains/create.xml.builder b/app/views/epp/domains/create.xml.builder index 2293f5657c..e4f4d969b7 100644 --- a/app/views/epp/domains/create.xml.builder +++ b/app/views/epp/domains/create.xml.builder @@ -5,7 +5,7 @@ xml.epp_head do end xml.resData do - xml.tag!('domain:creData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do + xml.tag!('domain:creData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis')) do xml.tag!('domain:name', @domain.name) xml.tag!('domain:crDate', @domain.created_at.try(:iso8601)) xml.tag!('domain:exDate', @domain.valid_to.iso8601) diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index ce5d609414..a2079dbce5 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -5,7 +5,7 @@ xml.epp_head do end xml.resData do - xml.tag! 'domain:infData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd' do + xml.tag! 'domain:infData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis') do xml.tag!('domain:name', @domain.name) xml.tag!('domain:roid', @domain.roid) @domain.statuses.each do |s| diff --git a/app/views/epp/domains/partials/_transfer.xml.builder b/app/views/epp/domains/partials/_transfer.xml.builder index bfcc7db94f..4e15699082 100644 --- a/app/views/epp/domains/partials/_transfer.xml.builder +++ b/app/views/epp/domains/partials/_transfer.xml.builder @@ -1,4 +1,4 @@ -builder.tag!('domain:trnData', 'xmlns:domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') do +builder.tag!('domain:trnData', 'xmlns:domain' => Xsd::Schema.filename(for_prefix: 'domain-eis')) do builder.tag!('domain:name', dt.domain_name) builder.tag!('domain:trStatus', dt.status) builder.tag!('domain:reID', dt.new_registrar.code) diff --git a/app/views/epp/domains/renew.xml.builder b/app/views/epp/domains/renew.xml.builder index e407ff0e74..89a939af5f 100644 --- a/app/views/epp/domains/renew.xml.builder +++ b/app/views/epp/domains/renew.xml.builder @@ -5,7 +5,7 @@ xml.epp_head do end 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' => Xsd::Schema.filename(for_prefix: 'domain-eis')) do xml.tag!('domain:name', @domain[:name]) xml.tag!('domain:exDate', @domain.valid_to.iso8601) end diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder index be6b94a6a5..a21585d1a4 100644 --- a/app/views/epp/error.xml.builder +++ b/app/views/epp/error.xml.builder @@ -7,8 +7,9 @@ xml.epp_head do xml.result('code' => x[:code]) do xml.msg(x[:msg], 'lang' => 'en') model_name = resource ? resource.model_name.singular.sub('epp_','') : controller.controller_name.singularize + prefix = model_name == 'poll' ? 'changePoll' : model_name + '-eis' - xml.value("xmlns:#{model_name}" => "https://epp.tld.ee/schema/#{model_name}-eis-1.0.xsd") do + xml.value("xmlns:#{model_name}" => Xsd::Schema.filename(for_prefix: prefix)) do value = x[:value][:val] attrs = {} attrs["s"] = value if x[:value][:obj] == "status" diff --git a/app/views/epp/poll/_action.xml.builder b/app/views/epp/poll/_action.xml.builder index 72d2c1cacf..dc0adb4e42 100644 --- a/app/views/epp/poll/_action.xml.builder +++ b/app/views/epp/poll/_action.xml.builder @@ -1,9 +1,9 @@ builder.extension do builder.tag!('changePoll:changeData', - 'xmlns:changePoll' => 'https://epp.tld.ee/schema/changePoll-1.0.xsd') do + 'xmlns:changePoll' => Xsd::Schema.filename(for_prefix: 'changePoll')) do builder.tag!('changePoll:operation', action.operation) builder.tag!('changePoll:date', action.created_at.utc.xmlschema) builder.tag!('changePoll:svTRID', action.id) builder.tag!('changePoll:who', action.user) end -end \ No newline at end of file +end diff --git a/app/views/epp/poll/poll_req.xml.builder b/app/views/epp/poll/poll_req.xml.builder index a58b082c5f..9f8173deab 100644 --- a/app/views/epp/poll/poll_req.xml.builder +++ b/app/views/epp/poll/poll_req.xml.builder @@ -20,7 +20,7 @@ xml.epp_head do state = @notification.text.include?('unlocked') ? 'unlock' : 'lock' xml.extension do xml.tag!('changePoll:changeData', - 'xmlns:changePoll': 'https://epp.tld.ee/schema/changePoll-1.0.xsd') do + 'xmlns:changePoll': Xsd::Schema.filename(for_prefix: 'changePoll')) do xml.tag!('changePoll:operation', state) end end diff --git a/app/views/epp/sessions/greeting.xml.builder b/app/views/epp/sessions/greeting.xml.builder index 072d2ead14..c1461f2e24 100644 --- a/app/views/epp/sessions/greeting.xml.builder +++ b/app/views/epp/sessions/greeting.xml.builder @@ -5,12 +5,12 @@ xml.epp_head do xml.svcMenu do xml.version '1.0' xml.lang 'en' - xml.objURI 'https://epp.tld.ee/schema/domain-eis-1.0.xsd' - xml.objURI 'https://epp.tld.ee/schema/contact-ee-1.1.xsd' + xml.objURI Xsd::Schema.filename(for_prefix: 'domain-eis') + xml.objURI Xsd::Schema.filename(for_prefix: 'contact-ee') xml.objURI 'urn:ietf:params:xml:ns:host-1.0' xml.svcExtension do xml.extURI 'urn:ietf:params:xml:ns:secDNS-1.1' - xml.extURI 'https://epp.tld.ee/schema/eis-1.0.xsd' + xml.extURI Xsd::Schema.filename(for_prefix: 'eis') end end diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/check.xml b/app/views/registrar/xml_consoles/epp_requests/contact/check.xml index 97e049e0b0..f8d6e05cea 100644 --- a/app/views/registrar/xml_consoles/epp_requests/contact/check.xml +++ b/app/views/registrar/xml_consoles/epp_requests/contact/check.xml @@ -1,9 +1,9 @@ - + + xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}"> sh8013 diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml b/app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml index ffc3e06a15..b71871ed1f 100644 --- a/app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml +++ b/app/views/registrar/xml_consoles/epp_requests/contact/check_multiple.xml @@ -1,9 +1,9 @@ - + + xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}"> sh8013 sh13 vsdfvq diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/create.xml b/app/views/registrar/xml_consoles/epp_requests/contact/create.xml index ff10b83702..2607a75823 100644 --- a/app/views/registrar/xml_consoles/epp_requests/contact/create.xml +++ b/app/views/registrar/xml_consoles/epp_requests/contact/create.xml @@ -1,8 +1,8 @@ - + - + Sillius Soddus @@ -20,7 +20,7 @@ - + 123 dGVzdCBmYWlsCg== diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/delete.xml b/app/views/registrar/xml_consoles/epp_requests/contact/delete.xml index a86c4ac0ca..2d2e483a2d 100644 --- a/app/views/registrar/xml_consoles/epp_requests/contact/delete.xml +++ b/app/views/registrar/xml_consoles/epp_requests/contact/delete.xml @@ -1,9 +1,9 @@ - + + xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee')}"> sh8013 wrong-one @@ -11,7 +11,7 @@ - + dGVzdCBmYWlsCg== diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/info.xml b/app/views/registrar/xml_consoles/epp_requests/contact/info.xml index 4ff7bc08cd..01685a3a17 100644 --- a/app/views/registrar/xml_consoles/epp_requests/contact/info.xml +++ b/app/views/registrar/xml_consoles/epp_requests/contact/info.xml @@ -1,8 +1,8 @@ - + - + sh8013 Aas34fq diff --git a/app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml b/app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml index 62cc103db7..e7fa45dde6 100644 --- a/app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml +++ b/app/views/registrar/xml_consoles/epp_requests/contact/update_chg.xml @@ -1,8 +1,8 @@ - + - + sh8013 @@ -25,7 +25,7 @@ - + dGVzdCBmYWlsCg== diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/check.xml b/app/views/registrar/xml_consoles/epp_requests/domain/check.xml index 73304adb0d..4c03654cd6 100644 --- a/app/views/registrar/xml_consoles/epp_requests/domain/check.xml +++ b/app/views/registrar/xml_consoles/epp_requests/domain/check.xml @@ -1,9 +1,9 @@ - + + xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}"> example.ee diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/client_hold.xml b/app/views/registrar/xml_consoles/epp_requests/domain/client_hold.xml index fcafec5380..31c9c21af4 100644 --- a/app/views/registrar/xml_consoles/epp_requests/domain/client_hold.xml +++ b/app/views/registrar/xml_consoles/epp_requests/domain/client_hold.xml @@ -1,9 +1,9 @@ - + + xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}"> example.ee diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/create.xml b/app/views/registrar/xml_consoles/epp_requests/domain/create.xml index ef13928599..d962ef2595 100644 --- a/app/views/registrar/xml_consoles/epp_requests/domain/create.xml +++ b/app/views/registrar/xml_consoles/epp_requests/domain/create.xml @@ -1,9 +1,9 @@ - + + xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}"> example.ee 1 @@ -31,7 +31,7 @@ AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8 - + dGVzdCBmYWlsCg== diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/delete.xml b/app/views/registrar/xml_consoles/epp_requests/domain/delete.xml index 16b78b73f5..f7a004982e 100644 --- a/app/views/registrar/xml_consoles/epp_requests/domain/delete.xml +++ b/app/views/registrar/xml_consoles/epp_requests/domain/delete.xml @@ -1,14 +1,14 @@ - + + xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}"> example.ee - + dGVzdCBmYWlsCg== diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/info.xml b/app/views/registrar/xml_consoles/epp_requests/domain/info.xml index 7e9bc4e3ae..c791008244 100644 --- a/app/views/registrar/xml_consoles/epp_requests/domain/info.xml +++ b/app/views/registrar/xml_consoles/epp_requests/domain/info.xml @@ -1,9 +1,9 @@ - + + xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}"> example.ee 2fooBAR diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/renew.xml b/app/views/registrar/xml_consoles/epp_requests/domain/renew.xml index 68d560c068..9993bc1e0c 100644 --- a/app/views/registrar/xml_consoles/epp_requests/domain/renew.xml +++ b/app/views/registrar/xml_consoles/epp_requests/domain/renew.xml @@ -1,9 +1,9 @@ - + + xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}"> example.ee 2014-08-07 1 diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml b/app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml index e373e64ee5..7f94ca60e5 100644 --- a/app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml +++ b/app/views/registrar/xml_consoles/epp_requests/domain/transfer.xml @@ -1,9 +1,9 @@ - + + xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}"> example.ee 2BARfoo @@ -11,7 +11,7 @@ - + dGVzdCBmYWlsCg== diff --git a/app/views/registrar/xml_consoles/epp_requests/domain/update.xml b/app/views/registrar/xml_consoles/epp_requests/domain/update.xml index 57f4957913..3318a7e519 100644 --- a/app/views/registrar/xml_consoles/epp_requests/domain/update.xml +++ b/app/views/registrar/xml_consoles/epp_requests/domain/update.xml @@ -1,9 +1,9 @@ - + + xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}"> example.ee @@ -43,7 +43,7 @@ - + dGVzdCBmYWlsCg== diff --git a/app/views/registrar/xml_consoles/epp_requests/poll/poll.xml b/app/views/registrar/xml_consoles/epp_requests/poll/poll.xml index 5ffed010e6..abf77ae194 100644 --- a/app/views/registrar/xml_consoles/epp_requests/poll/poll.xml +++ b/app/views/registrar/xml_consoles/epp_requests/poll/poll.xml @@ -1,5 +1,5 @@ - + ABC-12345 diff --git a/lib/epp_constraint.rb b/lib/epp_constraint.rb index 1200a6075e..1720d3202b 100644 --- a/lib/epp_constraint.rb +++ b/lib/epp_constraint.rb @@ -1,8 +1,8 @@ class EppConstraint OBJECT_TYPES = { - domain: { domain: 'https://epp.tld.ee/schema/domain-eis-1.0.xsd' }, - contact: { contact: 'https://epp.tld.ee/schema/contact-ee-1.1.xsd' } - } + domain: { domain: Xsd::Schema.filename(for_prefix: 'domain-eis') }, + contact: { contact: Xsd::Schema.filename(for_prefix: 'contact-ee') }, + }.freeze def initialize(type) @type = type diff --git a/lib/gem_monkey_patches/builder.rb b/lib/gem_monkey_patches/builder.rb index d4ebe2efdd..5502399996 100644 --- a/lib/gem_monkey_patches/builder.rb +++ b/lib/gem_monkey_patches/builder.rb @@ -3,7 +3,7 @@ class XmlMarkup def epp_head instruct! epp( - 'xmlns' => 'https://epp.tld.ee/schema/epp-ee-1.0.xsd', + 'xmlns' => ::Xsd::Schema.filename(for_prefix: 'epp-ee'), 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'lib/schemas/epp-ee-1.0.xsd' ) do diff --git a/test/integration/admin_area/domain_update_confirms_test.rb b/test/integration/admin_area/domain_update_confirms_test.rb index 9eb79685f2..bf504983b8 100644 --- a/test/integration/admin_area/domain_update_confirms_test.rb +++ b/test/integration/admin_area/domain_update_confirms_test.rb @@ -1,7 +1,7 @@ require 'test_helper' require 'application_system_test_case' -class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCase +class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCase setup do WebMock.allow_net_connect! sign_in users(:admin) @@ -15,10 +15,10 @@ def test_t puts new_registrant.name request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -26,7 +26,7 @@ def test_t - + #{'test' * 2000} @@ -50,10 +50,10 @@ def update_registrant_of_domain @domain.registrant request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -61,7 +61,7 @@ def update_registrant_of_domain - + #{'test' * 2000} @@ -77,4 +77,4 @@ def update_registrant_of_domain puts @domain.registrant end -end \ No newline at end of file +end diff --git a/test/integration/admin_area/epp_logs_test.rb b/test/integration/admin_area/epp_logs_test.rb index 5ad514cb8c..221e05f8c5 100644 --- a/test/integration/admin_area/epp_logs_test.rb +++ b/test/integration/admin_area/epp_logs_test.rb @@ -16,7 +16,7 @@ def test_show_epp_log_page visit admin_epp_logs_path send_epp_request_hello visit admin_epp_logs_path - + find(:xpath, "//tbody/tr/td/a", match: :first).click assert_text 'Details' end @@ -34,14 +34,14 @@ def test_dates_sort date_now = Date.today.to_s(:db) assert_match /#{date_now}/, epp_log_date - end + end private def send_epp_request_hello request_xml = <<-XML - + XML diff --git a/test/integration/epp/base_test.rb b/test/integration/epp/base_test.rb index 41fb186fed..51f1f37a90 100644 --- a/test/integration/epp/base_test.rb +++ b/test/integration/epp/base_test.rb @@ -44,7 +44,7 @@ def test_additional_error def test_error_with_unknown_command invalid_xml = <<-XML - + XML @@ -57,7 +57,7 @@ def test_error_with_unknown_command def test_validates_request_xml invalid_xml = <<-XML - + XML post valid_command_path, params: { frame: invalid_xml }, @@ -69,10 +69,10 @@ def test_validates_request_xml def test_anonymous_user xml_of_epp_command_that_requires_authentication = <<-XML - + - + #{domains(:shop).name} @@ -93,10 +93,10 @@ def test_non_authorized_user xml_of_epp_command_that_requires_authorization = <<-XML - + - + #{domains(:shop).name} @@ -119,10 +119,10 @@ def test_deletes_session_when_timed_out authentication_enabled_epp_request_xml = <<-XML - + - + #{domains(:shop).name} @@ -146,10 +146,10 @@ def test_session_last_access_is_updated_when_not_timed_out authentication_enabled_epp_request_xml = <<-XML - + - + #{domains(:shop).name} @@ -175,7 +175,7 @@ def valid_command_path def valid_request_xml <<-XML - + XML diff --git a/test/integration/epp/contact/base_test.rb b/test/integration/epp/contact/base_test.rb index 79bb8579ce..2767fe2772 100644 --- a/test/integration/epp/contact/base_test.rb +++ b/test/integration/epp/contact/base_test.rb @@ -4,10 +4,10 @@ class EppContactBaseTest < EppTestCase def test_non_existent_contact request_xml = <<-XML - + - + non-existent diff --git a/test/integration/epp/contact/check/base_test.rb b/test/integration/epp/contact/check/base_test.rb index 8f7e3df16f..104bc1b867 100644 --- a/test/integration/epp/contact/check/base_test.rb +++ b/test/integration/epp/contact/check/base_test.rb @@ -10,10 +10,10 @@ def test_returns_valid_response request_xml = <<-XML - + - + john-001 @@ -32,10 +32,10 @@ def test_returns_valid_response def test_contact_is_available request_xml = <<-XML - + - + non-existing-id @@ -57,10 +57,10 @@ def test_contact_is_unavailable request_xml = <<-XML - + - + john-001 @@ -79,10 +79,10 @@ def test_contact_is_unavailable def test_multiple_contacts request_xml = <<-XML - + - + one.test two.test three.test @@ -105,10 +105,10 @@ def test_check_contact_with_prefix request_xml = <<-XML - + - + BESTNAMES:JOHN-001 @@ -131,10 +131,10 @@ def test_check_contact_without_prefix request_xml = <<-XML - + - + JOHN-001 @@ -154,6 +154,6 @@ def test_check_contact_without_prefix private def xml_schema - 'https://epp.tld.ee/schema/contact-ee-1.1.xsd' + Xsd::Schema.filename(for_prefix: 'contact-ee') end end diff --git a/test/integration/epp/contact/create/base_test.rb b/test/integration/epp/contact/create/base_test.rb index 262487a1eb..d247ca0a27 100644 --- a/test/integration/epp/contact/create/base_test.rb +++ b/test/integration/epp/contact/create/base_test.rb @@ -8,10 +8,10 @@ def test_creates_new_contact_with_required_attributes request_xml = <<-XML - + - + #{name} @@ -20,7 +20,7 @@ def test_creates_new_contact_with_required_attributes - + any @@ -48,10 +48,10 @@ def test_responces_error_with_email_error request_xml = <<-XML - + - + #{name} @@ -60,7 +60,7 @@ def test_responces_error_with_email_error - + any @@ -83,10 +83,10 @@ def test_respects_custom_code request_xml = <<-XML - + - + #{code} #{name} @@ -96,7 +96,7 @@ def test_respects_custom_code - + any @@ -114,10 +114,10 @@ def test_respects_custom_code def test_fails_when_required_attributes_are_missing request_xml = <<-XML - + - + \s @@ -126,7 +126,7 @@ def test_fails_when_required_attributes_are_missing - + test @@ -148,10 +148,10 @@ def test_does_not_save_address_when_address_processing_turned_off request_xml = <<-XML - + - + #{name} @@ -167,7 +167,7 @@ def test_does_not_save_address_when_address_processing_turned_off - + 123 @@ -207,10 +207,10 @@ def test_saves_address_when_address_processing_turned_on request_xml = <<-XML - + - + #{name} @@ -226,7 +226,7 @@ def test_saves_address_when_address_processing_turned_on - + 123 diff --git a/test/integration/epp/contact/delete/base_test.rb b/test/integration/epp/contact/delete/base_test.rb index e86bea9dd8..6171ad00a3 100644 --- a/test/integration/epp/contact/delete/base_test.rb +++ b/test/integration/epp/contact/delete/base_test.rb @@ -9,10 +9,10 @@ def test_deletes_contact request_xml = <<-XML - + - + #{contact.code} @@ -36,10 +36,10 @@ def test_delete_contact_with_server_delete_prohibited request_xml = <<-XML - + - + #{contact.code.upcase} @@ -63,10 +63,10 @@ def test_delete_contact_with_client_delete_prohibited request_xml = <<-XML - + - + #{contact.code.upcase} @@ -90,10 +90,10 @@ def test_undeletable_cannot_be_deleted request_xml = <<-XML - + - + #{contact.code} diff --git a/test/integration/epp/contact/info/base_test.rb b/test/integration/epp/contact/info/base_test.rb index 3edb6d4610..5c4a99b2f7 100644 --- a/test/integration/epp/contact/info/base_test.rb +++ b/test/integration/epp/contact/info/base_test.rb @@ -18,10 +18,10 @@ def test_returns_valid_response request_xml = <<-XML - + - + john-001 @@ -50,10 +50,10 @@ def test_get_info_about_contact_with_prefix request_xml = <<-XML - + - + TEST:JOHN-001 @@ -76,10 +76,10 @@ def test_get_info_about_contact_without_prefix request_xml = <<-XML - + - + JOHN-001 @@ -105,10 +105,10 @@ def test_hides_password_and_name_when_current_registrar_is_not_sponsoring request_xml = <<-XML - + - + #{@contact.code} @@ -128,6 +128,6 @@ def test_hides_password_and_name_when_current_registrar_is_not_sponsoring private def xml_schema - 'https://epp.tld.ee/schema/contact-ee-1.1.xsd' + Xsd::Schema.filename(for_prefix: 'contact-ee') end end diff --git a/test/integration/epp/contact/transfer/base_test.rb b/test/integration/epp/contact/transfer/base_test.rb index 2d4ebb62cf..b1cc86a691 100644 --- a/test/integration/epp/contact/transfer/base_test.rb +++ b/test/integration/epp/contact/transfer/base_test.rb @@ -5,10 +5,10 @@ class EppContactTransferBaseTest < EppTestCase def test_not_implemented request_xml = <<-XML - + - + any diff --git a/test/integration/epp/contact/update/base_test.rb b/test/integration/epp/contact/update/base_test.rb index ff43905de1..1c02746ff5 100644 --- a/test/integration/epp/contact/update/base_test.rb +++ b/test/integration/epp/contact/update/base_test.rb @@ -19,10 +19,10 @@ def test_updates_contact request_xml = <<-XML - + - + john-001 @@ -56,10 +56,10 @@ def test_notifies_contact_by_email_when_email_is_changed request_xml = <<-XML - + - + john-001 john-new@inbox.test @@ -85,10 +85,10 @@ def test_skips_notifying_contact_when_email_is_not_changed request_xml = <<-XML - + - + john-001 john@inbox.test @@ -117,10 +117,10 @@ def test_skips_notifying_a_contact_when_a_contact_is_not_a_registrant request_xml = <<-XML - + - + john-001 john-new@inbox.test @@ -142,10 +142,10 @@ def test_non_existing_contact request_xml = <<-XML - + - + non-existing @@ -173,10 +173,10 @@ def test_ident_code_cannot_be_updated request_xml = <<-XML - + - + #{@contact.code} @@ -185,7 +185,7 @@ def test_ident_code_cannot_be_updated - + #{new_ident_code} @@ -208,10 +208,10 @@ def test_ident_type_and_ident_country_code_can_be_updated_when_absent request_xml = <<-XML - + - + #{@contact.code} @@ -219,7 +219,7 @@ def test_ident_type_and_ident_country_code_can_be_updated_when_absent - + #{@contact.ident} @@ -244,10 +244,10 @@ def test_updates_address_when_address_processing_turned_on request_xml = <<-XML - + - + #{@contact.code} @@ -290,10 +290,10 @@ def test_does_not_update_address_when_address_processing_turned_off request_xml = <<-XML - + - + #{@contact.code} @@ -337,10 +337,10 @@ def test_update_contact_with_update_prohibited request_xml = <<-XML - + - + #{@contact.code} @@ -388,10 +388,10 @@ def test_legal_document request_xml = <<-XML - + - + john-001 @@ -403,7 +403,7 @@ def test_legal_document - + #{'test' * 2000} @@ -416,7 +416,7 @@ def test_legal_document headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @contact.reload end - + assert_epp_response :completed_successfully assert_equal 'new name', @contact.name assert_equal 'new-email@inbox.test', @contact.email diff --git a/test/integration/epp/domain/base_test.rb b/test/integration/epp/domain/base_test.rb index 34d9fb2bd3..c13f49eef6 100644 --- a/test/integration/epp/domain/base_test.rb +++ b/test/integration/epp/domain/base_test.rb @@ -4,10 +4,10 @@ class EppDomainBaseTest < EppTestCase def test_non_existent_domain request_xml = <<-XML - + - + non-existent.test diff --git a/test/integration/epp/domain/check/auction_test.rb b/test/integration/epp/domain/check/auction_test.rb index 9fee851b65..3447016e3f 100644 --- a/test/integration/epp/domain/check/auction_test.rb +++ b/test/integration/epp/domain/check/auction_test.rb @@ -17,10 +17,10 @@ def test_domain_is_unavailable_when_at_auction request_xml = <<-XML - + - + auction.test @@ -33,8 +33,8 @@ def test_domain_is_unavailable_when_at_auction response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_idn_ascii_domain_is_unavailable_when_at_auction @@ -42,10 +42,10 @@ def test_idn_ascii_domain_is_unavailable_when_at_auction request_xml = <<-XML - + - + xn--pramiid-n2a.test @@ -58,8 +58,8 @@ def test_idn_ascii_domain_is_unavailable_when_at_auction response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_idn_unicode_domain_is_unavailable_when_at_auction @@ -67,10 +67,10 @@ def test_idn_unicode_domain_is_unavailable_when_at_auction request_xml = <<-XML - + - + püramiid.test @@ -83,8 +83,8 @@ def test_idn_unicode_domain_is_unavailable_when_at_auction response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_equal 'Domain is at auction', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_domain_is_unavailable_when_awaiting_payment @@ -92,10 +92,10 @@ def test_domain_is_unavailable_when_awaiting_payment request_xml = <<-XML - + - + auction.test @@ -108,8 +108,8 @@ def test_domain_is_unavailable_when_awaiting_payment response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_equal 'Awaiting payment', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_equal 'Awaiting payment', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_domain_is_available_when_payment_received @@ -117,10 +117,10 @@ def test_domain_is_available_when_payment_received request_xml = <<-XML - + - + auction.test @@ -133,7 +133,7 @@ def test_domain_is_available_when_payment_received response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_nil response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') + assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}") end end diff --git a/test/integration/epp/domain/check/base_test.rb b/test/integration/epp/domain/check/base_test.rb index 5966f62390..f418fa8a24 100644 --- a/test/integration/epp/domain/check/base_test.rb +++ b/test/integration/epp/domain/check/base_test.rb @@ -4,10 +4,10 @@ class EppDomainCheckBaseTest < EppTestCase def test_returns_valid_response request_xml = <<-XML - + - + some.test @@ -20,16 +20,16 @@ def test_returns_valid_response response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal 'some.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal 'some.test', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_domain_is_available_when_not_registered_or_blocked request_xml = <<-XML - + - + available.test @@ -41,8 +41,8 @@ def test_domain_is_available_when_not_registered_or_blocked headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) - assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_nil response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') + assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}") end def test_domain_is_available_when_reserved @@ -50,10 +50,10 @@ def test_domain_is_available_when_reserved request_xml = <<-XML - + - + reserved.test @@ -65,17 +65,17 @@ def test_domain_is_available_when_reserved headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) - assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_nil response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') + assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_nil response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}") end def test_domain_is_unavailable_when_format_is_invalid request_xml = <<-XML - + - + invalid @@ -87,8 +87,8 @@ def test_domain_is_unavailable_when_format_is_invalid headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) - assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_equal 'invalid format', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_equal 'invalid format', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_domain_is_unavailable_when_registered @@ -96,10 +96,10 @@ def test_domain_is_unavailable_when_registered request_xml = <<-XML - + - + shop.test @@ -111,8 +111,8 @@ def test_domain_is_unavailable_when_registered headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) - assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_equal 'in use', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_equal 'in use', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_domain_is_unavailable_when_blocked @@ -120,10 +120,10 @@ def test_domain_is_unavailable_when_blocked request_xml = <<-XML - + - + blocked.test @@ -135,8 +135,8 @@ def test_domain_is_unavailable_when_blocked headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) - assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_equal 'Blocked', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_equal 'Blocked', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_domain_is_unavailable_when_zone_with_the_same_origin_exists @@ -144,10 +144,10 @@ def test_domain_is_unavailable_when_zone_with_the_same_origin_exists request_xml = <<-XML - + - + test @@ -159,17 +159,17 @@ def test_domain_is_unavailable_when_zone_with_the_same_origin_exists headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) - assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] - assert_equal 'Zone with the same origin exists', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['avail'] + assert_equal 'Zone with the same origin exists', response_xml.at_xpath('//domain:reason', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_multiple_domains request_xml = <<-XML - + - + one.test two.test three.test @@ -183,6 +183,6 @@ def test_multiple_domains headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) - assert_equal 3, response_xml.xpath('//domain:cd', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').size + assert_equal 3, response_xml.xpath('//domain:cd', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").size end end diff --git a/test/integration/epp/domain/create/auction_idn_test.rb b/test/integration/epp/domain/create/auction_idn_test.rb index 822253ee54..170b4eb79e 100644 --- a/test/integration/epp/domain/create/auction_idn_test.rb +++ b/test/integration/epp/domain/create/auction_idn_test.rb @@ -21,16 +21,16 @@ def test_domain_with_ascii_idn_cannot_be_registered_without_registration_code request_xml = <<-XML - + - + xn--pramiid-n2a.test #{contacts(:john).code} - + #{'test' * 2000} @@ -56,16 +56,16 @@ def test_domain_with_unicode_idn_cannot_be_registered_without_registration_code request_xml = <<-XML - + - + püramiid.test #{contacts(:john).code} - + #{'test' * 2000} @@ -90,16 +90,16 @@ def test_domain_with_ascii_idn_cannot_be_registered_without_winning_the_auction request_xml = <<-XML - + - + xn--pramiid-n2a.test #{contacts(:john).code} - + #{'test' * 2000} @@ -124,16 +124,16 @@ def test_domain_with_unicode_idn_cannot_be_registered_without_winning_the_auctio request_xml = <<-XML - + - + püramiid.test #{contacts(:john).code} - + #{'test' * 2000} @@ -159,16 +159,16 @@ def test_registers_unicode_domain_with_correct_registration_code_when_payment_is request_xml = <<-XML - + - + püramiid.test #{contacts(:john).code} - + #{'test' * 2000} auction001 @@ -196,16 +196,16 @@ def test_registers_ascii_domain_with_correct_registration_code_when_payment_is_r request_xml = <<-XML - + - + xn--pramiid-n2a.test #{contacts(:john).code} - + #{'test' * 2000} auction001 diff --git a/test/integration/epp/domain/create/auction_test.rb b/test/integration/epp/domain/create/auction_test.rb index 7e4c2ecb7a..1e9d5fa326 100644 --- a/test/integration/epp/domain/create/auction_test.rb +++ b/test/integration/epp/domain/create/auction_test.rb @@ -13,16 +13,16 @@ class EppDomainCreateAuctionTest < EppTestCase def test_registers_domain_without_registration_code_when_not_at_auction request_xml = <<-XML - + - + not-at-auction.test #{contacts(:john).code} - + #{'test' * 2000} @@ -48,16 +48,16 @@ def test_registers_domain_with_correct_registration_code_after_another_auction_w request_xml = <<-XML - + - + auction.test #{contacts(:john).code} - + #{'test' * 2000} auction002 @@ -81,16 +81,16 @@ def test_registers_domain_with_correct_registration_code_when_payment_is_receive request_xml = <<-XML - + - + auction.test #{contacts(:john).code} - + #{'test' * 2000} auction001 @@ -117,16 +117,16 @@ def test_domain_cannot_be_registered_without_registration_code request_xml = <<-XML - + - + auction.test #{contacts(:john).code} - + #{'test' * 2000} @@ -147,16 +147,16 @@ def test_domain_cannot_be_registered_with_wrong_registration_code request_xml = <<-XML - + - + auction.test #{contacts(:john).code} - + #{'test' * 2000} wrong @@ -179,16 +179,16 @@ def test_domain_cannot_be_registered_when_payment_is_not_received request_xml = <<-XML - + - + auction.test #{contacts(:john).code} - + #{'test' * 2000} test @@ -211,15 +211,15 @@ def test_domain_cannot_be_registered_when_at_auction request_xml = <<-XML - + - + auction.test - + test diff --git a/test/integration/epp/domain/create/base_test.rb b/test/integration/epp/domain/create/base_test.rb index b8fd851be5..fbfd1e15b8 100644 --- a/test/integration/epp/domain/create/base_test.rb +++ b/test/integration/epp/domain/create/base_test.rb @@ -53,16 +53,16 @@ def test_too_small_legal_document request_xml = <<-XML - + - + #{name} #{registrant.code} - + #{'test' * 2} @@ -86,16 +86,16 @@ def test_too_big_legal_document request_xml = <<-XML - + - + #{name} #{registrant.code} - + #{bignum_legaldoc} @@ -122,16 +122,16 @@ def test_upper_limit_of_value_legal_document request_xml = <<-XML - + - + #{name} #{registrant.code} - + #{bignum_legaldoc} @@ -158,10 +158,10 @@ def test_not_registers_domain_without_legaldoc request_xml = <<-XML - + - + #{name} #{registrant.code} @@ -187,10 +187,10 @@ def test_create_domain_with_unique_contact request_xml = <<-XML - + - + #{name} #{registrant.code} #{contacts(:jane).code} @@ -198,7 +198,7 @@ def test_create_domain_with_unique_contact - + #{'test' * 2000} @@ -223,10 +223,10 @@ def test_create_domain_with_array_of_not_unique_admins_and_techs request_xml = <<-XML - + - + #{name} #{registrant.code} #{contact.code} @@ -236,7 +236,7 @@ def test_create_domain_with_array_of_not_unique_admins_and_techs - + #{'test' * 2000} @@ -261,10 +261,10 @@ def test_create_domain_with_array_of_not_unique_admins request_xml = <<-XML - + - + #{name} #{registrant.code} #{contact.code} @@ -273,7 +273,7 @@ def test_create_domain_with_array_of_not_unique_admins - + #{'test' * 2000} @@ -298,10 +298,10 @@ def test_create_domain_with_array_of_not_unique_techs request_xml = <<-XML - + - + #{name} #{registrant.code} #{contact.code} @@ -310,7 +310,7 @@ def test_create_domain_with_array_of_not_unique_techs - + #{'test' * 2000} @@ -336,10 +336,10 @@ def test_create_domain_with_array_of_not_unique_admin_but_tech_another_one request_xml = <<-XML - + - + #{name} #{registrant.code} #{contact.code} @@ -348,7 +348,7 @@ def test_create_domain_with_array_of_not_unique_admin_but_tech_another_one - + #{'test' * 2000} @@ -374,10 +374,10 @@ def test_create_domain_with_array_of_not_unique_techs_but_admin_another_one request_xml = <<-XML - + - + #{name} #{registrant.code} #{contact_two.code} @@ -386,7 +386,7 @@ def test_create_domain_with_array_of_not_unique_techs_but_admin_another_one - + #{'test' * 2000} @@ -411,16 +411,16 @@ def test_registers_new_domain_with_required_attributes request_xml = <<-XML - + - + #{name} #{registrant.code} - + #{'test' * 2000} @@ -459,10 +459,10 @@ def test_registers_domain_without_legaldoc_if_optout request_xml = <<-XML - + - + #{name} #{registrant.code} @@ -495,10 +495,10 @@ def test_does_not_registers_domain_without_legaldoc_if_mandatory request_xml = <<-XML - + - + #{name} #{registrant.code} @@ -529,16 +529,16 @@ def test_registers_reserved_domain_with_registration_code request_xml = <<-XML - + - + #{reserved_domain.name} #{contacts(:john).code} - + #{'test' * 2000} #{registration_code} @@ -565,10 +565,10 @@ def test_respects_custom_transfer_code request_xml = <<-XML - + - + #{name} #{contacts(:john).code} @@ -577,7 +577,7 @@ def test_respects_custom_transfer_code - + #{'test' * 2000} @@ -598,16 +598,16 @@ def test_blocked_domain_cannot_be_registered request_xml = <<-XML - + - + #{blocked_domain} #{contacts(:john).code} - + #{'test' * 2000} @@ -628,16 +628,16 @@ def test_blocked_punicode_domain_cannot_be_registered request_xml = <<-XML - + - + #{SimpleIDN.to_ascii('blockedäöüõ.test')} #{contacts(:john).code} - + #{'test' * 2000} @@ -655,16 +655,16 @@ def test_blocked_punicode_domain_cannot_be_registered def test_reserved_domain_cannot_be_registered_with_wrong_registration_code request_xml = <<-XML - + - + #{reserved_domains(:one).name} #{contacts(:john).code} - + #{'test' * 2000} wrong @@ -687,16 +687,16 @@ def test_reserved_domain_cannot_be_registered_without_registration_code request_xml = <<-XML - + - + #{reserved_domain.name} #{contacts(:john).code} - + #{'test' * 2000} @@ -717,16 +717,16 @@ def test_insufficient_funds request_xml = <<-XML - + - + new.test #{contacts(:john).code} - + #{'test' * 2000} @@ -745,17 +745,17 @@ def test_no_price request_xml = <<-XML - + - + new.test 2 john-001 - + #{'test' * 2000} diff --git a/test/integration/epp/domain/delete/base_test.rb b/test/integration/epp/domain/delete/base_test.rb index 830d7363d4..0e8af8f20d 100644 --- a/test/integration/epp/domain/delete/base_test.rb +++ b/test/integration/epp/domain/delete/base_test.rb @@ -18,15 +18,15 @@ def test_bypasses_domain_and_registrant_and_contacts_validation request_xml = <<-XML - + - + invalid.test - + #{'test' * 2000} @@ -45,15 +45,15 @@ def test_discarded_domain_cannot_be_deleted request_xml = <<-XML - + - + shop.test - + #{'test' * 2000} @@ -73,15 +73,15 @@ def test_requests_registrant_confirmation_when_required request_xml = <<-XML - + - + shop.test - + #{'test' * 2000} @@ -107,15 +107,15 @@ def test_skips_registrant_confirmation_when_not_required request_xml = <<-XML - + - + shop.test - + #{'test' * 2000} @@ -141,15 +141,15 @@ def test_deletes_on_update_prohibited request_xml = <<-XML - + - + shop.test - + #{'test' * 2000} @@ -174,15 +174,15 @@ def test_skips_registrant_confirmation_when_required_but_already_verified_by_reg request_xml = <<-XML - + - + shop.test - + #{'test' * 2000} @@ -207,10 +207,10 @@ def test_legal_document_is_optional request_xml = <<-XML - + - + shop.test @@ -229,15 +229,15 @@ def test_domain_cannot_be_deleted_when_explicitly_prohibited_by_registrar request_xml = <<-XML - + - + shop.test - + dGVzdCBmYWlsCg== diff --git a/test/integration/epp/domain/info/base_test.rb b/test/integration/epp/domain/info/base_test.rb index b9054e5531..71c303fcac 100644 --- a/test/integration/epp/domain/info/base_test.rb +++ b/test/integration/epp/domain/info/base_test.rb @@ -10,10 +10,10 @@ def test_returns_valid_response request_xml = <<-XML - + - + shop.test @@ -26,12 +26,12 @@ def test_returns_valid_response response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal 'shop.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text - assert_equal 'ok', response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['s'] - assert_equal 'john-001', response_xml.at_xpath('//domain:registrant', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text - assert_equal '2010-07-05T00:00:00+03:00', response_xml.at_xpath('//domain:crDate', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text - assert_equal '2010-07-06T00:00:00+03:00', response_xml.at_xpath('//domain:upDate', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text - assert_equal '2010-07-07T00:00:00+03:00', response_xml.at_xpath('//domain:exDate', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal 'shop.test', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text + assert_equal 'ok', response_xml.at_xpath('//domain:status', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['s'] + assert_equal 'john-001', response_xml.at_xpath('//domain:registrant', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text + assert_equal '2010-07-05T00:00:00+03:00', response_xml.at_xpath('//domain:crDate', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text + assert_equal '2010-07-06T00:00:00+03:00', response_xml.at_xpath('//domain:upDate', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text + assert_equal '2010-07-07T00:00:00+03:00', response_xml.at_xpath('//domain:exDate', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_returns_valid_response_if_disputed @@ -49,10 +49,10 @@ def test_returns_valid_response_if_disputed request_xml = <<-XML - + - + shop.test @@ -76,10 +76,10 @@ def test_reveals_transfer_code_when_domain_is_owned_by_current_user request_xml = <<-XML - + - + shop.test @@ -91,7 +91,7 @@ def test_reveals_transfer_code_when_domain_is_owned_by_current_user headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) - assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end # Transfer code is the only info we conceal from other registrars, hence a bit oddly-looking @@ -101,10 +101,10 @@ def test_reveals_transfer_code_when_domain_is_not_owned_by_current_user_and_tran request_xml = <<-XML - + - + shop.test 65078d5 @@ -119,16 +119,16 @@ def test_reveals_transfer_code_when_domain_is_not_owned_by_current_user_and_tran headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } response_xml = Nokogiri::XML(response.body) - assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_conceals_transfer_code_when_domain_is_not_owned_by_current_user request_xml = <<-XML - + - + shop.test @@ -144,6 +144,6 @@ def test_conceals_transfer_code_when_domain_is_not_owned_by_current_user response_xml = Nokogiri::XML(response.body) assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw', - 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') + 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}") end end diff --git a/test/integration/epp/domain/renew/base_test.rb b/test/integration/epp/domain/renew/base_test.rb index 7c58d325d5..51f0a553e8 100644 --- a/test/integration/epp/domain/renew/base_test.rb +++ b/test/integration/epp/domain/renew/base_test.rb @@ -11,10 +11,10 @@ def test_renews_domain request_xml = <<-XML - + - + #{domain.name} #{domain.expire_time.to_date} 1 @@ -42,10 +42,10 @@ def test_renews_domain_if_update_prohibited request_xml = <<-XML - + - + #{domain.name} #{domain.expire_time.to_date} 1 @@ -69,10 +69,10 @@ def test_domain_cannot_be_renewed_when_invalid request_xml = <<-XML - + - + #{domain.name} #{domain.valid_to.to_date} 1 @@ -97,10 +97,10 @@ def test_domain_cannot_be_renewed_when_belongs_to_another_registrar request_xml = <<-XML - + - + #{domain.name} #{domain.valid_to.to_date} 1 @@ -125,10 +125,10 @@ def test_insufficient_funds request_xml = <<-XML - + - + #{domain.name} #{domain.expire_time.to_date} 1 @@ -152,10 +152,10 @@ def test_no_price request_xml = <<-XML - + - + #{domain.name} #{domain.expire_time.to_date} 2 @@ -180,10 +180,10 @@ def test_fails_when_provided_expiration_date_is_wrong request_xml = <<-XML - + - + #{domain.name} #{provided_expiration_date} @@ -211,10 +211,10 @@ def test_fails_if_domain_has_renewal_prohibited_statuses request_xml = <<-XML - + - + #{domain.name} #{domain.expire_time.to_date} 1 diff --git a/test/integration/epp/domain/transfer/query_test.rb b/test/integration/epp/domain/transfer/query_test.rb index d6f62e2236..2cd25b8f94 100644 --- a/test/integration/epp/domain/transfer/query_test.rb +++ b/test/integration/epp/domain/transfer/query_test.rb @@ -6,19 +6,19 @@ def test_returns_domain_transfer_details headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } xml_doc = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text - assert_equal 'serverApproved', xml_doc.xpath('//domain:trStatus', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text - assert_equal 'goodnames', xml_doc.xpath('//domain:reID', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text - assert_equal 'bestnames', xml_doc.xpath('//domain:acID', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text + assert_equal 'serverApproved', xml_doc.xpath('//domain:trStatus', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text + assert_equal 'goodnames', xml_doc.xpath('//domain:reID', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text + assert_equal 'bestnames', xml_doc.xpath('//domain:acID', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_wrong_transfer_code request_xml = <<-XML - + - + shop.test wrong @@ -47,10 +47,10 @@ def test_no_domain_transfer def request_xml <<-XML - + - + shop.test 65078d5 diff --git a/test/integration/epp/domain/transfer/request_test.rb b/test/integration/epp/domain/transfer/request_test.rb index 273a9f4909..6aab45f98f 100644 --- a/test/integration/epp/domain/transfer/request_test.rb +++ b/test/integration/epp/domain/transfer/request_test.rb @@ -23,7 +23,7 @@ def test_transfer_domain_with_contacts_if_registrant_and_tech_are_shared headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } assert_epp_response :completed_successfully - + @domain.reload tech = Contact.find_by(id: @domain.tech_domain_contacts[0].contact_id) @@ -35,7 +35,7 @@ def test_transfer_domain_with_contacts_if_registrant_and_tech_are_shared def test_transfer_domain_with_contacts_if_registrant_and_admin_are_shared @domain.admin_domain_contacts[0].update!(contact_id: @domain.registrant.id) @domain.tech_domain_contacts[0].update!(contact_id: @contact.id) - + @domain.tech_domain_contacts[1].delete @domain.reload @@ -43,7 +43,7 @@ def test_transfer_domain_with_contacts_if_registrant_and_admin_are_shared headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } assert_epp_response :completed_successfully - + @domain.reload admin = Contact.find_by(id: @domain.admin_domain_contacts[0].contact_id) @@ -119,7 +119,7 @@ def test_approves_automatically_if_auto_approval_is_enabled post epp_transfer_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } assert_equal 'serverApproved', Nokogiri::XML(response.body).xpath('//domain:trStatus', 'domain' => - 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_assigns_new_registrar @@ -201,10 +201,10 @@ def test_same_registrar def test_wrong_transfer_code request_xml = <<-XML - + - + shop.test wrong @@ -228,10 +228,10 @@ def test_wrong_transfer_code def request_xml <<-XML - + - + shop.test 65078d5 @@ -239,7 +239,7 @@ def request_xml - + #{'test' * 2000} diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb index 1a43667aeb..9db760fe23 100644 --- a/test/integration/epp/domain/update/base_test.rb +++ b/test/integration/epp/domain/update/base_test.rb @@ -20,10 +20,10 @@ class EppDomainUpdateBaseTest < EppTestCase def test_update_domain request_xml = <<-XML - + - + shop.test @@ -48,10 +48,10 @@ def test_discarded_domain_cannot_be_updated request_xml = <<-XML - + - + shop.test @@ -69,10 +69,10 @@ def test_prohibited_domain_cannot_be_updated request_xml = <<-XML - + - + shop.test @@ -90,10 +90,10 @@ def test_does_not_return_server_delete_prohibited_status_when_pending_update_sta DomainStatus::PENDING_UPDATE]) request_xml = <<-XML - + - + #{@domain.name} @@ -106,7 +106,7 @@ def test_does_not_return_server_delete_prohibited_status_when_pending_update_sta assert_epp_response :object_status_prohibits_operation response_xml = Nokogiri::XML(response.body) - assert_equal DomainStatus::PENDING_UPDATE, response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text + assert_equal DomainStatus::PENDING_UPDATE, response_xml.at_xpath('//domain:status', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text end def test_requires_verification_from_current_registrant_when_provided_registrant_is_a_new_one @@ -116,10 +116,10 @@ def test_requires_verification_from_current_registrant_when_provided_registrant_ request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -127,7 +127,7 @@ def test_requires_verification_from_current_registrant_when_provided_registrant_ - + #{'test' * 2000} @@ -160,10 +160,10 @@ def test_domain_should_doesnt_have_pending_update_when_updated_registrant_with_s request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -171,7 +171,7 @@ def test_domain_should_doesnt_have_pending_update_when_updated_registrant_with_s - + #{'test' * 2000} @@ -195,10 +195,10 @@ def test_requires_verification_from_current_registrant_when_not_yet_verified_by_ request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -206,7 +206,7 @@ def test_requires_verification_from_current_registrant_when_not_yet_verified_by_ - + #{'test' * 2000} @@ -238,10 +238,10 @@ def test_updates_registrant_when_legaldoc_is_not_mandatory request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -274,10 +274,10 @@ def test_dows_not_update_registrant_when_legaldoc_is_mandatory request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -308,10 +308,10 @@ def test_domain_should_not_padding_if_registrant_update_with_same_ident request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -319,7 +319,7 @@ def test_domain_should_not_padding_if_registrant_update_with_same_ident - + #{'test' * 2000} @@ -342,10 +342,10 @@ def test_skips_verification_when_provided_registrant_is_the_same_as_current_one request_xml = <<-XML - + - + #{@domain.name} #{@domain.registrant.code} @@ -353,7 +353,7 @@ def test_skips_verification_when_provided_registrant_is_the_same_as_current_one - + #{'test' * 2000} @@ -381,10 +381,10 @@ def test_skips_verification_when_registrant_changed_with_dispute_password request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -392,7 +392,7 @@ def test_skips_verification_when_registrant_changed_with_dispute_password - + #{'test' * 2000} #{dispute.password} @@ -424,10 +424,10 @@ def test_dispute_password_mandatory_when_registrant_changed request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -435,7 +435,7 @@ def test_dispute_password_mandatory_when_registrant_changed - + #{'test' * 2000} '123456' @@ -463,10 +463,10 @@ def test_skips_verification_when_disabled request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -474,7 +474,7 @@ def test_skips_verification_when_disabled - + #{'test' * 2000} @@ -500,10 +500,10 @@ def test_skips_verification_from_current_registrant_when_already_verified_by_reg request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -511,7 +511,7 @@ def test_skips_verification_from_current_registrant_when_already_verified_by_reg - + #{'test' * 2000} @@ -539,10 +539,10 @@ def test_clears_force_delete_when_registrar_changed request_xml = <<-XML - + - + #{@domain.name} #{new_registrant.code} @@ -550,7 +550,7 @@ def test_clears_force_delete_when_registrar_changed - + #{'test' * 2000} @@ -576,10 +576,10 @@ def test_deactivates_domain_when_all_name_servers_are_removed request_xml = <<-XML - + - + #{@domain.name} @@ -608,10 +608,10 @@ def test_deactivates_domain_when_all_name_servers_are_removed def test_update_domain_allows_add_of_client_hold request_xml = <<-XML - + - + shop.test Test @@ -636,10 +636,10 @@ def test_update_domain_allows_remove_of_client_hold request_xml = <<-XML - + - + shop.test Test @@ -661,10 +661,10 @@ def test_update_domain_returns_error_when_removing_unassigned_status assert_not_includes(@domain.statuses, DomainStatus::CLIENT_HOLD) request_xml = <<-XML - + - + #{@domain.name} diff --git a/test/integration/epp/hello_test.rb b/test/integration/epp/hello_test.rb index b2e03c20bd..721ae5932c 100644 --- a/test/integration/epp/hello_test.rb +++ b/test/integration/epp/hello_test.rb @@ -4,7 +4,7 @@ class EppHelloTest < EppTestCase def test_anonymous_user_is_able_to_access request_xml = <<-XML - + XML diff --git a/test/integration/epp/login_test.rb b/test/integration/epp/login_test.rb index dd7a750c91..369c15e335 100644 --- a/test/integration/epp/login_test.rb +++ b/test/integration/epp/login_test.rb @@ -15,7 +15,7 @@ def test_logging_in_with_correct_credentials_creates_new_session request_xml = <<-XML - + #{user.username} @@ -25,8 +25,8 @@ def test_logging_in_with_correct_credentials_creates_new_session en - https://epp.tld.ee/schema/domain-eis-1.0.xsd - https://epp.tld.ee/schema/contact-ee-1.1.xsd + #{Xsd::Schema.filename(for_prefix: 'domain-eis')} + #{Xsd::Schema.filename(for_prefix: 'contact-ee')} urn:ietf:params:xml:ns:host-1.0 urn:ietf:params:xml:ns:keyrelay-1.0 @@ -50,7 +50,7 @@ def test_user_cannot_login_again request_xml = <<-XML - + #{user.username} @@ -60,8 +60,8 @@ def test_user_cannot_login_again en - https://epp.tld.ee/schema/domain-eis-1.0.xsd - https://epp.tld.ee/schema/contact-ee-1.1.xsd + #{Xsd::Schema.filename(for_prefix: 'domain-eis')} + #{Xsd::Schema.filename(for_prefix: 'contact-ee')} urn:ietf:params:xml:ns:host-1.0 urn:ietf:params:xml:ns:keyrelay-1.0 @@ -84,7 +84,7 @@ def test_user_cannot_login_with_wrong_credentials request_xml = <<-XML - + #{user.username} @@ -94,8 +94,8 @@ def test_user_cannot_login_with_wrong_credentials en - https://epp.tld.ee/schema/domain-eis-1.0.xsd - https://epp.tld.ee/schema/contact-ee-1.1.xsd + #{Xsd::Schema.filename(for_prefix: 'domain-eis')} + #{Xsd::Schema.filename(for_prefix: 'contact-ee')} urn:ietf:params:xml:ns:host-1.0 urn:ietf:params:xml:ns:keyrelay-1.0 @@ -118,7 +118,7 @@ def test_password_change request_xml = <<-XML - + #{user.username} @@ -129,8 +129,8 @@ def test_password_change en - https://epp.tld.ee/schema/domain-eis-1.0.xsd - https://epp.tld.ee/schema/contact-ee-1.1.xsd + #{Xsd::Schema.filename(for_prefix: 'domain-eis')} + #{Xsd::Schema.filename(for_prefix: 'contact-ee')} urn:ietf:params:xml:ns:host-1.0 urn:ietf:params:xml:ns:keyrelay-1.0 @@ -154,7 +154,7 @@ def test_user_cannot_login_when_max_allowed_sessions_per_registrar_is_exceeded request_xml = <<-XML - + #{user.username} @@ -164,8 +164,8 @@ def test_user_cannot_login_when_max_allowed_sessions_per_registrar_is_exceeded en - https://epp.tld.ee/schema/domain-eis-1.0.xsd - https://epp.tld.ee/schema/contact-ee-1.1.xsd + #{Xsd::Schema.filename(for_prefix: 'domain-eis')} + #{Xsd::Schema.filename(for_prefix: 'contact-ee')} urn:ietf:params:xml:ns:host-1.0 urn:ietf:params:xml:ns:keyrelay-1.0 diff --git a/test/integration/epp/logout_test.rb b/test/integration/epp/logout_test.rb index 62fa06ca94..7d53bfd4d4 100644 --- a/test/integration/epp/logout_test.rb +++ b/test/integration/epp/logout_test.rb @@ -30,7 +30,7 @@ def test_anonymous_user def request_xml <<-XML - + diff --git a/test/integration/epp/poll_test.rb b/test/integration/epp/poll_test.rb index a18fdbe4eb..fc41307d2a 100644 --- a/test/integration/epp/poll_test.rb +++ b/test/integration/epp/poll_test.rb @@ -9,7 +9,7 @@ class EppPollTest < EppTestCase def test_return_latest_notification_when_queue_is_not_empty request_xml = <<-XML - + @@ -32,7 +32,7 @@ def test_does_not_drop_error_if_old_version request_xml = <<-XML - + @@ -56,7 +56,7 @@ def test_return_action_data_when_present request_xml = <<-XML - + @@ -66,7 +66,7 @@ def test_return_action_data_when_present headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } xml_doc = Nokogiri::XML(response.body) - namespace = 'https://epp.tld.ee/schema/changePoll-1.0.xsd' + namespace = Xsd::Schema.filename(for_prefix: 'changePoll') assert_equal 'update', xml_doc.xpath('//changePoll:operation', 'changePoll' => namespace).text assert_equal Time.zone.parse('2010-07-05').utc.xmlschema, xml_doc.xpath('//changePoll:date', 'changePoll' => namespace).text @@ -81,7 +81,7 @@ def test_no_notifications request_xml = <<-XML - + @@ -98,7 +98,7 @@ def test_mark_as_read request_xml = <<-XML - + @@ -121,7 +121,7 @@ def test_notification_of_other_registrars_cannot_be_marked_as_read request_xml = <<-XML - + @@ -138,7 +138,7 @@ def test_notification_of_other_registrars_cannot_be_marked_as_read def test_notification_not_found request_xml = <<-XML - + @@ -153,7 +153,7 @@ def test_notification_not_found def test_anonymous_user_cannot_access request_xml = <<-XML - + diff --git a/test/lib/deserializers/xml/contact_test.rb b/test/lib/deserializers/xml/contact_test.rb index 4621efeb28..0ad86bbd98 100644 --- a/test/lib/deserializers/xml/contact_test.rb +++ b/test/lib/deserializers/xml/contact_test.rb @@ -14,10 +14,10 @@ def test_trims_empty_values def test_handles_update xml_string = <<-XML - + - + john-001 @@ -48,10 +48,10 @@ def test_handles_create xml_string = <<-XML - + - + #{name} @@ -60,7 +60,7 @@ def test_handles_create - + any @@ -76,10 +76,10 @@ def test_handles_create def test_handles_statuses xml_string = <<-XML - + - + john-001 diff --git a/test/lib/deserializers/xml/ident_test.rb b/test/lib/deserializers/xml/ident_test.rb index beff7aef52..ff9989e21e 100644 --- a/test/lib/deserializers/xml/ident_test.rb +++ b/test/lib/deserializers/xml/ident_test.rb @@ -5,10 +5,10 @@ class DeserializersXmlIdentTest < ActiveSupport::TestCase def test_returns_empty_hash_when_not_present xml_string = <<-XML - + - + john-001 @@ -31,10 +31,10 @@ def test_returns_empty_hash_when_not_present def test_returns_empty_hash_when_not_valid xml_string = <<-XML - + - + FIRST0:SH2027223711 wrong password @@ -42,7 +42,7 @@ def test_returns_empty_hash_when_not_valid - + 37605030299 dGVzdCBmYWlsCg== @@ -60,10 +60,10 @@ def test_returns_empty_hash_when_not_valid def test_returns_complete_hash_when_valid xml_string = <<-XML - + - + FIRST0:SH2027223711 wrong password @@ -71,7 +71,7 @@ def test_returns_complete_hash_when_valid - + 37605030299 dGVzdCBmYWlsCg== diff --git a/test/lib/deserializers/xml/legal_document_test.rb b/test/lib/deserializers/xml/legal_document_test.rb index ac173ba4b2..bc4dec0804 100644 --- a/test/lib/deserializers/xml/legal_document_test.rb +++ b/test/lib/deserializers/xml/legal_document_test.rb @@ -5,10 +5,10 @@ class DeserializersXmlLegalDocumentTest < ActiveSupport::TestCase def test_returns_nil_when_required_fields_not_present xml_string = <<-XML - + - + john-001 @@ -32,10 +32,10 @@ def test_returns_nil_when_required_fields_not_present def test_returns_hash_when_document_exists xml_string = <<-XML - + - + FIRST0:SH2027223711 wrong password @@ -43,7 +43,7 @@ def test_returns_hash_when_document_exists - + 37605030299 dGVzdCBmYWlsCg== diff --git a/test/models/epp/response_test.rb b/test/models/epp/response_test.rb index 9f82bd2054..d9d699ba10 100644 --- a/test/models/epp/response_test.rb +++ b/test/models/epp/response_test.rb @@ -4,7 +4,7 @@ class EppResponseTest < ActiveSupport::TestCase def test_creates_new_response_from_xml_doc xml = <<-XML - + any