From 6e44f61e916f1792a392287cff350963af459dc9 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 17:22:35 +0200 Subject: [PATCH 01/20] Add "webmock" gem --- Gemfile | 1 + Gemfile.lock | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Gemfile b/Gemfile index f0f2e4395..83ec9b4a7 100644 --- a/Gemfile +++ b/Gemfile @@ -157,4 +157,5 @@ end group :test do gem 'database_cleaner' gem 'factory_girl_rails' + gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index f608c4c9f..31ecaeb02 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -257,6 +257,7 @@ GEM haml (>= 4.0.6, < 5.0) html2haml (>= 1.0.1) railties (>= 4.0.1) + hashdiff (0.3.1) hashie (3.4.2) hashie-forbidden_attributes (0.1.1) hashie (>= 3.0) @@ -556,6 +557,10 @@ GEM wasabi (3.5.0) httpi (~> 2.0) nokogiri (>= 1.4.2) + webmock (2.1.0) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff websocket-driver (0.6.2) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) @@ -647,6 +652,7 @@ DEPENDENCIES unicorn uuidtools (= 2.1.5) validates_email_format_of (= 1.6.3) + webmock whenever (= 0.9.4) BUNDLED WITH From 45b2d04eb9118eb318f7f4fc07fb9d700e97f086 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 17:23:16 +0200 Subject: [PATCH 02/20] Include "webmock" --- spec/spec_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9e1e69d61..68a2c0be1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +require 'webmock/rspec' + RSpec.configure do |config| # https://github.com/rspec/rspec-rails/issues/1076 config.around :each, type: :view do |example| From ef07538e40da816e442aceb55817ac7404d5e6fc Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 17:28:54 +0200 Subject: [PATCH 03/20] Configure spec types --- spec/rails_helper.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 9411702f5..7e1b6e6d5 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -24,9 +24,24 @@ RSpec.configure do |config| config.include ActionView::TestCase::Behavior, type: :presenter config.include ActiveSupport::Testing::TimeHelpers - config.define_derived_metadata(file_path: %r{/spec/presenters/}) do |metadata| + config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata| + metadata[:db] = true if metadata[:db].nil? + end + + config.define_derived_metadata(file_path: %r[/spec/models/]) do |metadata| + metadata[:db] = true if metadata[:db].nil? + end + + config.define_derived_metadata(file_path: %r[/spec/presenters/]) do |metadata| metadata[:type] = :presenter - metadata[:db] = false + end + + config.define_derived_metadata(file_path: %r[/spec/requests/]) do |metadata| + metadata[:db] = true if metadata[:db].nil? + end + + config.define_derived_metadata(file_path: %r[/spec/api/]) do |metadata| + metadata[:type] = :request end config.use_transactional_fixtures = false From e963de58cfc07b800d47cc96f74e3ef530d02876 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 17:29:45 +0200 Subject: [PATCH 04/20] Refactor database cleaner config --- spec/support/database_cleaner.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index 68a5de946..a65caba89 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -11,7 +11,7 @@ RSpec.configure do |config| end config.before :example do |example| - if example.metadata[:db] || (%i(model).include?(example.metadata[:type]) && example.metadata[:db].nil?) + if example.metadata[:db] db_connection_names.each do |connection_name| ActiveRecord::Base.establish_connection(connection_name) DatabaseCleaner[:active_record, connection: connection_name].start @@ -20,7 +20,7 @@ RSpec.configure do |config| end config.after :example do |example| - if example.metadata[:db] || (%i(model).include?(example.metadata[:type]) && example.metadata[:db].nil?) + if example.metadata[:db] db_connection_names.each do |connection_name| ActiveRecord::Base.establish_connection(connection_name) DatabaseCleaner[:active_record, connection: connection_name].clean From 4ae4c28d970c13be4f3dfefbb2c060392bc264b6 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 17:33:03 +0200 Subject: [PATCH 05/20] Add session helpers for request specs --- spec/rails_helper.rb | 2 ++ spec/support/requests/session_helpers.rb | 32 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 spec/support/requests/session_helpers.rb diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 7e1b6e6d5..8aa7acdc4 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -5,6 +5,7 @@ require 'rspec/rails' require 'capybara/poltergeist' require 'paper_trail/frameworks/rspec' require 'money-rails/test_helpers' +require 'support/requests/session_helpers' if ENV['ROBOT'] require 'simplecov' @@ -23,6 +24,7 @@ ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| config.include ActionView::TestCase::Behavior, type: :presenter config.include ActiveSupport::Testing::TimeHelpers + config.include Requests::SessionHelpers, type: :request config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata| metadata[:db] = true if metadata[:db].nil? diff --git a/spec/support/requests/session_helpers.rb b/spec/support/requests/session_helpers.rb new file mode 100644 index 000000000..d4019c5f9 --- /dev/null +++ b/spec/support/requests/session_helpers.rb @@ -0,0 +1,32 @@ +module Requests + module SessionHelpers + def sign_in_to_epp_area(user: FactoryGirl.create(:api_user)) + login_xml = " + + + + #{user.username} + #{user.password} + + 1.0 + en + + + https://epp.tld.ee/schema/domain-eis-1.0.xsd + https://epp.tld.ee/schema/contact-eis-1.0.xsd + urn:ietf:params:xml:ns:host-1.0 + urn:ietf:params:xml:ns:keyrelay-1.0 + + urn:ietf:params:xml:ns:secDNS-1.1 + https://epp.tld.ee/schema/eis-1.0.xsd + + + + ABC-12345 + + " + + post '/epp/session/login', frame: login_xml + end + end +end From ac083c3fb2f7179af325211ac9d40c81de7773fa Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 17:43:39 +0200 Subject: [PATCH 06/20] Remove xml schemas from doc --- doc/schemas/all-ee-1.0.xsd | 47 ---- doc/schemas/contact-1.0.xsd | 388 -------------------------- doc/schemas/contact-eis-1.0.xsd | 366 ------------------------- doc/schemas/domain-1.0.xsd | 432 ----------------------------- doc/schemas/domain-eis-1.0.xsd | 470 -------------------------------- doc/schemas/eis-1.0.xsd | 105 ------- doc/schemas/epp-1.0.xsd | 446 ------------------------------ doc/schemas/eppcom-1.0.xsd | 105 ------- doc/schemas/host-1.0.xsd | 238 ---------------- doc/schemas/keyrelay-1.0.xsd | 63 ----- doc/schemas/secDNS-1.1.xsd | 134 --------- 11 files changed, 2794 deletions(-) delete mode 100644 doc/schemas/all-ee-1.0.xsd delete mode 100644 doc/schemas/contact-1.0.xsd delete mode 100644 doc/schemas/contact-eis-1.0.xsd delete mode 100644 doc/schemas/domain-1.0.xsd delete mode 100644 doc/schemas/domain-eis-1.0.xsd delete mode 100644 doc/schemas/eis-1.0.xsd delete mode 100644 doc/schemas/epp-1.0.xsd delete mode 100644 doc/schemas/eppcom-1.0.xsd delete mode 100644 doc/schemas/host-1.0.xsd delete mode 100644 doc/schemas/keyrelay-1.0.xsd delete mode 100644 doc/schemas/secDNS-1.1.xsd diff --git a/doc/schemas/all-ee-1.0.xsd b/doc/schemas/all-ee-1.0.xsd deleted file mode 100644 index 5ad285c98..000000000 --- a/doc/schemas/all-ee-1.0.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Extensible Provisioning Protocol v1.0 - all schema's grouped together - - - - diff --git a/doc/schemas/contact-1.0.xsd b/doc/schemas/contact-1.0.xsd deleted file mode 100644 index 9b4c244cd..000000000 --- a/doc/schemas/contact-1.0.xsd +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - - - - Extensible Provisioning Protocol v1.0 - contact provisioning schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/doc/schemas/contact-eis-1.0.xsd b/doc/schemas/contact-eis-1.0.xsd deleted file mode 100644 index cec571cec..000000000 --- a/doc/schemas/contact-eis-1.0.xsd +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - - - - - Extensible Provisioning Protocol v1.0 - contact provisioning schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/schemas/domain-1.0.xsd b/doc/schemas/domain-1.0.xsd deleted file mode 100644 index 46859859e..000000000 --- a/doc/schemas/domain-1.0.xsd +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - - - - - Extensible Provisioning Protocol v1.0 - domain provisioning schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/doc/schemas/domain-eis-1.0.xsd b/doc/schemas/domain-eis-1.0.xsd deleted file mode 100644 index b38abf9d4..000000000 --- a/doc/schemas/domain-eis-1.0.xsd +++ /dev/null @@ -1,470 +0,0 @@ - - - - - - - - - - - - - - Extensible Provisioning Protocol v1.0 - domain provisioning schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/schemas/eis-1.0.xsd b/doc/schemas/eis-1.0.xsd deleted file mode 100644 index 0b2ad8f89..000000000 --- a/doc/schemas/eis-1.0.xsd +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - EIS Extensible Provisioning Protocol v1.0 extension schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/schemas/epp-1.0.xsd b/doc/schemas/epp-1.0.xsd deleted file mode 100644 index 3609ad55d..000000000 --- a/doc/schemas/epp-1.0.xsd +++ /dev/null @@ -1,446 +0,0 @@ - - - - - - - - - - - Extensible Provisioning Protocol v1.0 schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/schemas/eppcom-1.0.xsd b/doc/schemas/eppcom-1.0.xsd deleted file mode 100644 index 3b7d5d65c..000000000 --- a/doc/schemas/eppcom-1.0.xsd +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - Extensible Provisioning Protocol v1.0 - shared structures schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/schemas/host-1.0.xsd b/doc/schemas/host-1.0.xsd deleted file mode 100644 index d4bbc043e..000000000 --- a/doc/schemas/host-1.0.xsd +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - Extensible Provisioning Protocol v1.0 - host provisioning schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/doc/schemas/keyrelay-1.0.xsd b/doc/schemas/keyrelay-1.0.xsd deleted file mode 100644 index 2239754e7..000000000 --- a/doc/schemas/keyrelay-1.0.xsd +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - Extensible Provisioning Protocol v1.0 protocol - extension schema for relaying DNSSEC key material. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/schemas/secDNS-1.1.xsd b/doc/schemas/secDNS-1.1.xsd deleted file mode 100644 index a47c07a23..000000000 --- a/doc/schemas/secDNS-1.1.xsd +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - Extensible Provisioning Protocol v1.0 - domain name extension schema - for provisioning DNS security (DNSSEC) extensions. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From e6cd5f66c8636294ab2633dbab29847d17d4d4c7 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 17:45:28 +0200 Subject: [PATCH 07/20] Add admin user factory --- spec/factories/admin_user.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 spec/factories/admin_user.rb diff --git a/spec/factories/admin_user.rb b/spec/factories/admin_user.rb new file mode 100644 index 000000000..8ee6b93b9 --- /dev/null +++ b/spec/factories/admin_user.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :admin_user do + username 'test' + email 'test@test.com' + password 'a' * AdminUser.min_password_length + password_confirmation { password } + country_code 'de' + roles ['admin'] + end +end From 8de0b8b5917000476663a6e584c81df3a68c6aaa Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 17:48:09 +0200 Subject: [PATCH 08/20] Add session helper for feature specs --- spec/rails_helper.rb | 2 ++ spec/support/features/session_helpers.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 spec/support/features/session_helpers.rb diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 8aa7acdc4..6b4a3637e 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -6,6 +6,7 @@ require 'capybara/poltergeist' require 'paper_trail/frameworks/rspec' require 'money-rails/test_helpers' require 'support/requests/session_helpers' +require 'support/features/session_helpers' if ENV['ROBOT'] require 'simplecov' @@ -25,6 +26,7 @@ RSpec.configure do |config| config.include ActionView::TestCase::Behavior, type: :presenter config.include ActiveSupport::Testing::TimeHelpers config.include Requests::SessionHelpers, type: :request + config.include Features::SessionHelpers, type: :feature config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata| metadata[:db] = true if metadata[:db].nil? diff --git a/spec/support/features/session_helpers.rb b/spec/support/features/session_helpers.rb new file mode 100644 index 000000000..de0203e1a --- /dev/null +++ b/spec/support/features/session_helpers.rb @@ -0,0 +1,12 @@ +module Features + module SessionHelpers + def sign_in_to_registrar_area(user: FactoryGirl.create(:api_user)) + visit registrar_login_path + + fill_in 'depp_user_tag', with: user.username + fill_in 'depp_user_password', with: user.password + + click_button 'Login' + end + end +end From be5d1e82f14b2ba081d34f3068ea3a4b48fe24f0 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 18:41:14 +0200 Subject: [PATCH 09/20] Remove unused doc --- doc/epp-doc.md | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 doc/epp-doc.md diff --git a/doc/epp-doc.md b/doc/epp-doc.md deleted file mode 100644 index cf6ae2788..000000000 --- a/doc/epp-doc.md +++ /dev/null @@ -1,26 +0,0 @@ -# EPP integration specification - -Main communication specification through EPP: - -[Session related functions](epp/session.md) -[Contact related functions](epp/contact.md) -[Domain related functions](epp/domain.md) -[Keyrelay related functions](epp/keyrelay.md) - -Our implementation supports following protocols: - -[RFC5730 - EPP](http://tools.ietf.org/html/rfc5730) -[RFC5731 - Domain Mapping](http://tools.ietf.org/html/rfc5731) -[RFC5733 - Contact Mapping](http://tools.ietf.org/html/rfc5733) -[RFC5734 - Transport over TCP](http://tools.ietf.org/html/rfc5734) -[RFC5910 - DNSSEC Mapping](http://tools.ietf.org/html/rfc5910) -[RFC3735 - Guidelines for Extending the EPP](http://tools.ietf.org/html/rfc3735) - -EIS specific XML Schema Definitions (may differ from policies applied to registry): - -[contact-eis-1.0.xsd](schemas/contact-eis-1.0.xsd) -[domain-eis-1.0.xsd](schemas/domain-eis-1.0.xsd) -[eis-1.0.xsd](schemas/eis-1.0.xsd) - -More info about The Extensible Provisioning Protocol (EPP):
-http://en.wikipedia.org/wiki/Extensible_Provisioning_Protocol From 0260ebd2e428f99b7e8dfcd07223e9a5bd623a73 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 18:43:19 +0200 Subject: [PATCH 10/20] Improve EPP readme --- doc/epp/README.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/doc/epp/README.md b/doc/epp/README.md index 78047851c..33fe4c946 100644 --- a/doc/epp/README.md +++ b/doc/epp/README.md @@ -1,13 +1,13 @@ # EPP integration specification -Main communication specification through EPP: +## Main communication specification through EPP [Session related functions](session.md) [Contact related functions](contact.md) [Domain related functions](domain.md) [Keyrelay related functions](keyrelay.md) -Our implementation supports following protocols: +## Supported protocols [RFC5730 - EPP](http://tools.ietf.org/html/rfc5730) [RFC5731 - Domain Mapping](http://tools.ietf.org/html/rfc5731) @@ -16,5 +16,22 @@ Our implementation supports following protocols: [RFC5910 - DNSSEC Mapping](http://tools.ietf.org/html/rfc5910) [RFC3735 - Guidelines for Extending the EPP](http://tools.ietf.org/html/rfc3735) -More info about The Extensible Provisioning Protocol (EPP):
+## XML schemas + +### Common +* [domain-1.0.xsd](/lib/schemas/domain-1.0.xsd) +* [contact-1.0.xsd](/lib/schemas/contact-1.0.xsd) +* [all-ee-1.0.xsd](/lib/schemas/all-ee-1.0.xsd) +* [epp-1.0.xsd](/lib/schemas/epp-1.0.xsd) +* [eppcom-1.0.xsd](/lib/schemas/eppcom-1.0.xsd) +* [host-1.0.xsd](/lib/schemas/host-1.0.xsd) +* [keyrelay-1.0.xsd](/lib/schemas/keyrelay-1.0.xsd) +* [secDNS-1.1.xsd](/lib/schemas/secDNS-1.1.xsd) + +### EIS-specific +* [domain-eis-1.0.xsd](/lib/schemas/domain-eis-1.0.xsd) +* [contact-eis-1.0.xsd](/lib/schemas/contact-eis-1.0.xsd) +* [eis-1.0.xsd](/lib/schemas/eis-1.0.xsd) + +More info about The Extensible Provisioning Protocol (EPP): http://en.wikipedia.org/wiki/Extensible_Provisioning_Protocol From 75f13f95b38ae3ef254b7d1e84a61bdc39a70b76 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 18:44:58 +0200 Subject: [PATCH 11/20] Include translation helper in feature specs --- spec/rails_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6b4a3637e..ba0b3c53f 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -27,6 +27,7 @@ RSpec.configure do |config| config.include ActiveSupport::Testing::TimeHelpers config.include Requests::SessionHelpers, type: :request config.include Features::SessionHelpers, type: :feature + config.include AbstractController::Translation, type: :feature config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata| metadata[:db] = true if metadata[:db].nil? From be0d0ab095c4bd21411a883f2839e6c2665ddf1d Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 18:55:19 +0200 Subject: [PATCH 12/20] Fix session helpers spec support --- spec/support/features/session_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/features/session_helpers.rb b/spec/support/features/session_helpers.rb index de0203e1a..a23609891 100644 --- a/spec/support/features/session_helpers.rb +++ b/spec/support/features/session_helpers.rb @@ -1,7 +1,7 @@ module Features module SessionHelpers def sign_in_to_registrar_area(user: FactoryGirl.create(:api_user)) - visit registrar_login_path + visit registrar_login_url fill_in 'depp_user_tag', with: user.username fill_in 'depp_user_password', with: user.password From 0359d738081a4e1d87232b9c1902699b9ef022ba Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 18:59:13 +0200 Subject: [PATCH 13/20] Add api user factory --- spec/factories/api_user.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 spec/factories/api_user.rb diff --git a/spec/factories/api_user.rb b/spec/factories/api_user.rb new file mode 100644 index 000000000..d5a3c777d --- /dev/null +++ b/spec/factories/api_user.rb @@ -0,0 +1,8 @@ +FactoryGirl.define do + factory :api_user do + sequence(:username) { |n| "test#{n}" } + password 'a' * 6 + roles ['super'] + registrar + end +end From b08e881a24a192ad6947757874b9e667b56e82d2 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 19:02:31 +0200 Subject: [PATCH 14/20] Remove unneeded specs from admin user --- spec/models/admin_user_spec.rb | 38 +++++----------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/spec/models/admin_user_spec.rb b/spec/models/admin_user_spec.rb index a6b668a5d..36eeee603 100644 --- a/spec/models/admin_user_spec.rb +++ b/spec/models/admin_user_spec.rb @@ -1,24 +1,9 @@ require 'rails_helper' -require 'cancan/matchers' -describe AdminUser do +RSpec.describe AdminUser do context 'with invalid attribute' do - before :all do - @admin_user = AdminUser.new - end - - it 'should not be valid' do - @admin_user.valid? - @admin_user.errors.full_messages.should match_array([ - "Country code is missing", - "Email Email is missing", - "Email Email is missing", - "Password Password is missing", - "Password Password is missing", - "Password confirmation is missing", - "Roles is missing", - "Username Username is missing" - ]) + before do + @admin_user = described_class.new end it 'should not have any versions' do @@ -27,21 +12,10 @@ describe AdminUser do end context 'with valid attributes' do - before :all do + before do @admin_user = Fabricate(:admin_user) end - it 'should be valid' do - @admin_user.valid? - @admin_user.errors.full_messages.should match_array([]) - end - - it 'should be valid twice' do - @admin_user = Fabricate(:admin_user) - @admin_user.valid? - @admin_user.errors.full_messages.should match_array([]) - end - it 'should have one version' do with_versioning do @admin_user.versions.should == [] @@ -56,9 +30,7 @@ describe AdminUser do @admin_user.valid?.should == true @admin_user.password = 'not confirmed' @admin_user.valid? - @admin_user.errors.full_messages.should match_array([ - "Password confirmation doesn't match Password" - ]) + @admin_user.errors.full_messages.should match_array(["Password confirmation doesn't match Password"]) end end end From 14457921cc968f292cdb545928df4525b707dba0 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 19:04:25 +0200 Subject: [PATCH 15/20] Admin user model returns min password length --- app/models/admin_user.rb | 4 ++++ spec/models/admin_user_spec.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb index e062bb1d6..d76c42dec 100644 --- a/app/models/admin_user.rb +++ b/app/models/admin_user.rb @@ -11,6 +11,10 @@ class AdminUser < User devise :database_authenticatable, :rememberable, :trackable, :validatable, :lockable + def self.min_password_length + Devise.password_length.min + end + def to_s username end diff --git a/spec/models/admin_user_spec.rb b/spec/models/admin_user_spec.rb index 36eeee603..eeb47107b 100644 --- a/spec/models/admin_user_spec.rb +++ b/spec/models/admin_user_spec.rb @@ -33,4 +33,10 @@ RSpec.describe AdminUser do @admin_user.errors.full_messages.should match_array(["Password confirmation doesn't match Password"]) end end + + describe '::min_password_length' do + it 'returns minimum password length' do + expect(described_class.min_password_length).to eq(8) + end + end end From 1c7dbbb1e9e805e9be33016ba8cf01dde52b7032 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 19:28:10 +0200 Subject: [PATCH 16/20] Fix specs --- spec/features/registrar/sessions_spec.rb | 151 ----------------------- spec/models/domain_spec.rb | 2 +- 2 files changed, 1 insertion(+), 152 deletions(-) delete mode 100644 spec/features/registrar/sessions_spec.rb diff --git a/spec/features/registrar/sessions_spec.rb b/spec/features/registrar/sessions_spec.rb deleted file mode 100644 index 649fac952..000000000 --- a/spec/features/registrar/sessions_spec.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'rails_helper' - -RSpec.feature 'Sessions', db: true do - context 'with invalid ip' do - it 'should not see login page' do - Setting.registrar_ip_whitelist_enabled = true - WhiteIp.destroy_all - visit registrar_login_path - page.should have_text('Access denied') - end - - it 'should see login page when whitelist disabled' do - Setting.registrar_ip_whitelist_enabled = false - WhiteIp.destroy_all - visit registrar_login_path - page.should_not have_text('Access denied') - Setting.registrar_ip_whitelist_enabled = true - end - - it 'should see Login' do - @fixed_registrar = Fabricate(:registrar, name: 'fixed registrar', code: 'FIXED') - @fixed_registrar.white_ips = [Fabricate(:white_ip_registrar)] - visit registrar_login_path - page.should have_text('Login') - end - - it 'should not get in with invalid ip' do - Fabricate(:registrar, white_ips: [Fabricate(:white_ip), Fabricate(:white_ip_registrar)]) - @api_user_invalid_ip = Fabricate( - :api_user, identity_code: '37810013294', registrar: Fabricate(:registrar, white_ips: []) - ) - visit registrar_login_path - fill_in 'depp_user_tag', with: @api_user_invalid_ip.username - fill_in 'depp_user_password', with: @api_user_invalid_ip.password - click_button 'Login' - page.should have_text('IP is not whitelisted') - end - end - - context 'as unknown user' do - before :example do - Fabricate(:api_user) - end - - it 'should not get in' do - client = instance_double("Digidoc::Client") - allow(client).to receive(:authenticate).and_return( - OpenStruct.new( - user_id_code: '123' - ) - ) - - allow(Digidoc::Client).to receive(:new) { client } - - visit registrar_login_path - page.should have_css('a[href="/registrar/login/mid"]') - - page.find('a[href="/registrar/login/mid"]').click - - fill_in 'user_phone', with: '00007' - click_button 'Login' - page.should have_text('No such user') - end - end - - context 'as known api user' do - before :example do - Fabricate(:api_user) - end - - it 'should not get in when external service fails' do - client = instance_double("Digidoc::Client") - allow(client).to receive(:authenticate).and_return( - OpenStruct.new( - faultcode: 'Fault', - detail: OpenStruct.new( - message: 'Something is wrong' - ) - ) - ) - - allow(Digidoc::Client).to receive(:new) { client } - - visit registrar_login_path - page.should have_css('a[href="/registrar/login/mid"]') - - page.find('a[href="/registrar/login/mid"]').click - - fill_in 'user_phone', with: '00007' - click_button 'Login' - page.should have_text('Something is wrong') - end - - it 'should not get in when there is a sim error', js: true do - client = instance_double("Digidoc::Client", session_code: '123') - - allow(client).to receive('session_code=') - - allow(client).to receive(:authenticate).and_return( - OpenStruct.new( - user_id_code: '14212128025' - ) - ) - - allow(client).to receive('authentication_status').and_return( - OpenStruct.new(status: 'SIM_ERROR') - ) - - allow(Digidoc::Client).to receive(:new) { client } - - visit registrar_login_path - page.should have_css('a[href="/registrar/login/mid"]') - - page.find('a[href="/registrar/login/mid"]').click - - fill_in 'user_phone', with: '00007' - click_button 'Login' - - page.should have_text('Confirmation sms was sent to your phone. Verification code is') - page.should have_text('SIM application error') - end - - it 'should Login successfully', js: true do - client = instance_double("Digidoc::Client", session_code: '123') - - allow(client).to receive('session_code=') - - allow(client).to receive(:authenticate).and_return( - OpenStruct.new( - user_id_code: '14212128025' - ) - ) - - allow(client).to receive('authentication_status').and_return( - OpenStruct.new(status: 'USER_AUTHENTICATED') - ) - - allow(Digidoc::Client).to receive(:new) { client } - - visit registrar_login_path - page.should have_css('a[href="/registrar/login/mid"]') - - page.find('a[href="/registrar/login/mid"]').click - - fill_in 'user_phone', with: '00007' - click_button 'Login' - - page.should have_text('Confirmation sms was sent to your phone. Verification code is') - end - end -end diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb index 78ada6d51..186fbc685 100644 --- a/spec/models/domain_spec.rb +++ b/spec/models/domain_spec.rb @@ -482,7 +482,7 @@ RSpec.describe Domain do invalid = [ 'a.ee', "#{'a' * 64}.ee", 'ab.eu', 'test.ab.ee', '-test.ee', '-test-.ee', - 'test-.ee', 'te--st.ee', 'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', + 'test-.ee', 'te--st.ee', 'õ.pri.ee', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', 'Ž .ee', 'test.edu.ee' ] From aa39c069a1dc6782651aeb47799c935486eecd76 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 19:30:59 +0200 Subject: [PATCH 17/20] Fix missing translations --- config/locales/en.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 0988e1ce0..c4fb88757 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -614,6 +614,7 @@ en: delete: 'Delete' are_you_sure: 'Are you sure?' renew: 'Renew' + new: New renew_domain: 'Renew domain' cur_exp_date: 'curExpDate' transfer: 'Transfer' @@ -952,3 +953,4 @@ en: deleted: 'Deleted' cant_match_version: 'Impossible match version with request' user_not_authenticated: "user not authenticated" + actions: Actions From 03ef3e1c506e3dcb68049f78c3a8ec6815a87205 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 19:32:28 +0200 Subject: [PATCH 18/20] Update domain presenter --- app/presenters/domain_presenter.rb | 10 +++++++++- spec/presenters/domain_presenter_spec.rb | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/presenters/domain_presenter.rb b/app/presenters/domain_presenter.rb index b09743c5e..2d0cfd791 100644 --- a/app/presenters/domain_presenter.rb +++ b/app/presenters/domain_presenter.rb @@ -1,11 +1,19 @@ class DomainPresenter - delegate :name, :registrant_name, to: :domain + delegate :name, :registrant_name, :registrant_id, to: :domain def initialize(domain:, view:) @domain = domain @view = view end + def expire_time + view.l(domain.expire_time) + end + + def expire_date + view.l(domain.expire_time, format: :date) + end + def on_hold_date view.l(domain.on_hold_time, format: :date) if domain.on_hold_time end diff --git a/spec/presenters/domain_presenter_spec.rb b/spec/presenters/domain_presenter_spec.rb index 79adcc68f..2209c01aa 100644 --- a/spec/presenters/domain_presenter_spec.rb +++ b/spec/presenters/domain_presenter_spec.rb @@ -3,6 +3,24 @@ require 'rails_helper' RSpec.describe DomainPresenter do let(:presenter) { described_class.new(domain: domain, view: view) } + describe '#expire_time' do + let(:domain) { instance_double(Domain, expire_time: Time.zone.parse('05.07.2010')) } + + it 'returns localized time' do + expect(view).to receive(:l).with(Time.zone.parse('05.07.2010')).and_return('expire time') + expect(presenter.expire_time).to eq('expire time') + end + end + + describe '#expire_date' do + let(:domain) { instance_double(Domain, expire_time: Time.zone.parse('05.07.2010')) } + + it 'returns localized date' do + expect(view).to receive(:l).with(Time.zone.parse('05.07.2010'), format: :date).and_return('expire date') + expect(presenter.expire_date).to eq('expire date') + end + end + describe '#on_hold_date' do subject(:on_hold_date) { presenter.on_hold_date } @@ -100,6 +118,7 @@ RSpec.describe DomainPresenter do domain_delegatable_attributes = %i( name registrant_name + registrant_id ) domain_delegatable_attributes.each do |attribute_name| From 55b5e7a41de424a07685607ca57a963752afef75 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 8 Dec 2016 19:33:07 +0200 Subject: [PATCH 19/20] Do not autoload app/validators folder twice --- config/initializers/load_validators.rb | 1 - 1 file changed, 1 deletion(-) delete mode 100644 config/initializers/load_validators.rb diff --git a/config/initializers/load_validators.rb b/config/initializers/load_validators.rb deleted file mode 100644 index ea84920bf..000000000 --- a/config/initializers/load_validators.rb +++ /dev/null @@ -1 +0,0 @@ -Registry::Application.config.autoload_paths += %W(#{Registry::Application.config.root}/app/validators/) From 58419262aeaaa473bc5d8d6fb65b76880f6534b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 8 Dec 2016 21:59:16 +0200 Subject: [PATCH 20/20] Update README.md moved all-ee schema under ee specific --- doc/epp/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/epp/README.md b/doc/epp/README.md index 33fe4c946..21d1b9708 100644 --- a/doc/epp/README.md +++ b/doc/epp/README.md @@ -21,17 +21,17 @@ ### Common * [domain-1.0.xsd](/lib/schemas/domain-1.0.xsd) * [contact-1.0.xsd](/lib/schemas/contact-1.0.xsd) -* [all-ee-1.0.xsd](/lib/schemas/all-ee-1.0.xsd) * [epp-1.0.xsd](/lib/schemas/epp-1.0.xsd) * [eppcom-1.0.xsd](/lib/schemas/eppcom-1.0.xsd) * [host-1.0.xsd](/lib/schemas/host-1.0.xsd) * [keyrelay-1.0.xsd](/lib/schemas/keyrelay-1.0.xsd) * [secDNS-1.1.xsd](/lib/schemas/secDNS-1.1.xsd) -### EIS-specific -* [domain-eis-1.0.xsd](/lib/schemas/domain-eis-1.0.xsd) -* [contact-eis-1.0.xsd](/lib/schemas/contact-eis-1.0.xsd) -* [eis-1.0.xsd](/lib/schemas/eis-1.0.xsd) +### .ee-specific +* [all-ee-1.0.xsd](/lib/schemas/all-ee-1.0.xsd) +* [domain-eis-1.0.xsd](/lib/schemas/domain-eis-1.0.xsd) +* [contact-eis-1.0.xsd](/lib/schemas/contact-eis-1.0.xsd) +* [eis-1.0.xsd](/lib/schemas/eis-1.0.xsd) More info about The Extensible Provisioning Protocol (EPP): http://en.wikipedia.org/wiki/Extensible_Provisioning_Protocol