mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Merge branch 'master' into remove-spring-gem
# Conflicts: # config/environments/test.rb
This commit is contained in:
commit
78d7d5d894
39 changed files with 107 additions and 188 deletions
|
@ -1,5 +1,4 @@
|
||||||
class EppController < ApplicationController
|
class EppController < ApplicationController
|
||||||
include Iptable
|
|
||||||
layout false
|
layout false
|
||||||
protect_from_forgery with: :null_session
|
protect_from_forgery with: :null_session
|
||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
||||||
|
@ -359,12 +358,6 @@ class EppController < ApplicationController
|
||||||
# rubocop: enable Metrics/CyclomaticComplexity
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
# rubocop: enable Metrics/PerceivedComplexity
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
|
||||||
def iptables_counter_update
|
|
||||||
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'
|
|
||||||
return if current_user.blank?
|
|
||||||
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
|
|
||||||
end
|
|
||||||
|
|
||||||
def resource
|
def resource
|
||||||
name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize
|
name = self.class.to_s.sub("Epp::","").sub("Controller","").underscore.singularize
|
||||||
instance_variable_get("@#{name}")
|
instance_variable_get("@#{name}")
|
||||||
|
@ -407,4 +400,26 @@ class EppController < ApplicationController
|
||||||
timeout = 5.minutes
|
timeout = 5.minutes
|
||||||
epp_session.updated_at < (Time.zone.now - timeout)
|
epp_session.updated_at < (Time.zone.now - timeout)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def iptables_counter_update
|
||||||
|
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'
|
||||||
|
return if current_user.blank?
|
||||||
|
counter_update(current_user.registrar_code, ENV['iptables_server_ip'])
|
||||||
|
end
|
||||||
|
|
||||||
|
def counter_update(registrar_code, ip)
|
||||||
|
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
|
||||||
|
|
||||||
|
begin
|
||||||
|
File.open(counter_proc, 'a') do |f|
|
||||||
|
f.puts "+#{ip}"
|
||||||
|
end
|
||||||
|
rescue Errno::ENOENT => e
|
||||||
|
logger.error "IPTABLES COUNTER UPDATE: cannot open #{counter_proc}: #{e}"
|
||||||
|
rescue Errno::EACCES => e
|
||||||
|
logger.error "IPTABLES COUNTER UPDATE: no permission #{counter_proc}: #{e}"
|
||||||
|
rescue IOError => e
|
||||||
|
logger.error "IPTABLES COUNTER UPDATE: cannot write #{ip} to #{counter_proc}: #{e}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -372,8 +372,6 @@ class Contact < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def related_domain_descriptions
|
def related_domain_descriptions
|
||||||
ActiveSupport::Deprecation.warn('Use #domain_names_with_roles')
|
|
||||||
|
|
||||||
@desc = {}
|
@desc = {}
|
||||||
|
|
||||||
registrant_domains.each do |dom|
|
registrant_domains.each do |dom|
|
||||||
|
|
|
@ -199,21 +199,6 @@ class Domain < ActiveRecord::Base
|
||||||
statuses.include? DomainStatus::SERVER_TECH_CHANGE_PROHIBITED
|
statuses.include? DomainStatus::SERVER_TECH_CHANGE_PROHIBITED
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.clean_expired_pendings
|
|
||||||
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
|
|
||||||
DomainCron.send(__method__)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.start_redemption_grace_period
|
|
||||||
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
|
|
||||||
DomainCron.send(__method__)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.destroy_delete_candidates
|
|
||||||
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
|
|
||||||
DomainCron.send(__method__)
|
|
||||||
end
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def nameserver_required?
|
def nameserver_required?
|
||||||
Setting.nameserver_required
|
Setting.nameserver_required
|
||||||
|
|
|
@ -92,7 +92,7 @@ class DomainCron
|
||||||
if domain.save(validate: false)
|
if domain.save(validate: false)
|
||||||
::PaperTrail.whodunnit = "cron - #{__method__}"
|
::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
|
DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60 + DateTime.now.minute))).minutes.from_now)
|
||||||
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: job added by deleteCandidate status ##{domain.id} (#{domain.name})\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by deleteCandidate status ##{domain.id} (#{domain.name})\n" unless Rails.env.test?
|
||||||
c += 1
|
c += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
require 'countries'
|
|
||||||
require 'action_view'
|
|
||||||
|
|
||||||
class SortedCountry
|
class SortedCountry
|
||||||
class << self
|
class << self
|
||||||
include ActionView::Helpers
|
include ActionView::Helpers
|
||||||
|
|
||||||
def all_options(selected = nil)
|
def all_options(selected = nil)
|
||||||
quick_options = options_for_select(quick_list, { selected: selected })
|
quick_options = options_for_select(quick_list, selected: selected)
|
||||||
|
|
||||||
# no double select
|
# no double select
|
||||||
selected = quick_list.map(&:second).include?(selected) ? '' : selected
|
selected = quick_list.map(&:second).include?(selected) ? '' : selected
|
||||||
|
|
||||||
all_options = options_for_select([['---', '---']] + all_sorted_truncated,
|
all_options = options_for_select([['---', '---']] + all_sorted_truncated,
|
||||||
{ selected: selected, disabled: ['---'] })
|
selected: selected, disabled: ['---'])
|
||||||
quick_options + all_options
|
quick_options + all_options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,12 +18,12 @@ class SortedCountry
|
||||||
def quick_list
|
def quick_list
|
||||||
@quick_list ||=
|
@quick_list ||=
|
||||||
[
|
[
|
||||||
['Estonia', 'EE'],
|
%w[Estonia' EE],
|
||||||
['Finland', 'FI'],
|
%w[Finland FI],
|
||||||
['Latvia', 'LV'],
|
%w[Latvia LV],
|
||||||
['Lithuania', 'LT'],
|
%w[Lithuania LT],
|
||||||
['Russian Federation', 'RU'],
|
['Russian Federation', 'RU'],
|
||||||
['Sweden', 'SE'],
|
%w[Sweden SE],
|
||||||
['United States', 'US']
|
['United States', 'US']
|
||||||
]
|
]
|
||||||
end
|
end
|
|
@ -40,8 +40,8 @@ module DomainNameRegistry
|
||||||
|
|
||||||
# Autoload all model subdirs
|
# Autoload all model subdirs
|
||||||
config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
|
config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
|
||||||
config.autoload_paths << Rails.root.join('lib')
|
|
||||||
config.eager_load_paths << config.root.join('lib', 'validators')
|
config.eager_load_paths << config.root.join('lib', 'validators')
|
||||||
|
config.watchable_dirs['lib'] = %i[rb]
|
||||||
|
|
||||||
# Add the fonts path
|
# Add the fonts path
|
||||||
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
|
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
|
||||||
|
|
|
@ -1,52 +1,28 @@
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# The test environment is used exclusively to run your application's
|
|
||||||
# test suite. You never need to work with it otherwise. Remember that
|
|
||||||
# your test database is "scratch space" for the test suite and is wiped
|
|
||||||
# and recreated between test runs. Don't rely on the data there!
|
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
|
|
||||||
# Do not eager load code on boot. This avoids loading your whole application
|
|
||||||
# just for the purpose of running a single test. If you are using a tool that
|
|
||||||
# preloads Rails for running tests, you may have to set it to true.
|
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
|
|
||||||
# Configure static asset server for tests with Cache-Control for performance.
|
|
||||||
config.serve_static_files = true
|
config.serve_static_files = true
|
||||||
config.static_cache_control = 'public, max-age=3600'
|
config.static_cache_control = 'public, max-age=3600'
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
# Raise exceptions instead of rendering exception templates.
|
|
||||||
config.action_dispatch.show_exceptions = false
|
config.action_dispatch.show_exceptions = false
|
||||||
|
|
||||||
# Disable request forgery protection in test environment.
|
|
||||||
config.action_controller.allow_forgery_protection = false
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
# Tell Action Mailer not to deliver emails to the real world.
|
|
||||||
# The :test delivery method accumulates sent emails in the
|
|
||||||
# ActionMailer::Base.deliveries array.
|
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
config.active_support.test_order = :random
|
||||||
|
|
||||||
ActiveSupport::Deprecation.silenced = true
|
config.active_support.deprecation = :raise
|
||||||
|
config.logger = ActiveSupport::Logger.new(nil)
|
||||||
# For rails-settings-cached conflict
|
|
||||||
config.cache_store = :file_store, 'tmp/cache_test'
|
|
||||||
|
|
||||||
config.action_view.raise_on_missing_translations = true
|
config.action_view.raise_on_missing_translations = true
|
||||||
|
|
||||||
# The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown,
|
# If set to :null_store, Setting.x returns nil after first spec runs (database is emptied)
|
||||||
# corresponding to the log level numbers from 0 up to 5 respectively
|
config.cache_store = :memory_store
|
||||||
config.log_level = :debug
|
|
||||||
config.active_job.queue_adapter = :test
|
|
||||||
config.logger = ActiveSupport::Logger.new(nil)
|
|
||||||
config.active_support.test_order = :random # :random is the default in Rails 5
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# In this mode, any jobs you queue will be run in the same thread, synchronously
|
|
||||||
# (that is, MyJob.enqueue runs the job and won't return until it's completed).
|
|
||||||
# This makes your application's behavior easier to test
|
|
||||||
Que.mode = :sync
|
Que.mode = :sync
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require 'devise_custom_failure'
|
||||||
|
|
||||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||||
# Many of these configuration options can be set straight in your model.
|
# Many of these configuration options can be set straight in your model.
|
||||||
Devise.setup do |config|
|
Devise.setup do |config|
|
||||||
|
|
4
config/initializers/ext.rb
Normal file
4
config/initializers/ext.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
require 'core_ext/array'
|
||||||
|
require 'gem_ext/builder'
|
||||||
|
require 'gem_ext/i18n'
|
||||||
|
require 'gem_ext/paper_trail'
|
|
@ -51,8 +51,8 @@ if con.present? && con.table_exists?('settings')
|
||||||
Setting.save_default(:redemption_grace_period, 30)
|
Setting.save_default(:redemption_grace_period, 30)
|
||||||
Setting.save_default(:expiration_reminder_mail, 2)
|
Setting.save_default(:expiration_reminder_mail, 2)
|
||||||
|
|
||||||
Setting.save_default(:registrar_ip_whitelist_enabled, true)
|
Setting.save_default(:registrar_ip_whitelist_enabled, false)
|
||||||
Setting.save_default(:api_ip_whitelist_enabled, true)
|
Setting.save_default(:api_ip_whitelist_enabled, false)
|
||||||
|
|
||||||
Setting.save_default(:registry_juridical_name, 'Eesti Interneti SA')
|
Setting.save_default(:registry_juridical_name, 'Eesti Interneti SA')
|
||||||
Setting.save_default(:registry_reg_no, '90010019')
|
Setting.save_default(:registry_reg_no, '90010019')
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Dir[File.join(Rails.root, 'lib', 'ext', '*.rb')].each { |x| require x }
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'epp_constraint'
|
require_dependency 'epp_constraint'
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
namespace(:epp, defaults: { format: :xml }) do
|
namespace(:epp, defaults: { format: :xml }) do
|
||||||
|
|
|
@ -668,7 +668,6 @@
|
||||||
<text text-anchor="start" x="-72.5" y="-60.8" font-family="Times,serif" font-size="14.00">generate_svtrid</text>
|
<text text-anchor="start" x="-72.5" y="-60.8" font-family="Times,serif" font-size="14.00">generate_svtrid</text>
|
||||||
<text text-anchor="start" x="-72.5" y="-45.8" font-family="Times,serif" font-size="14.00">handle_errors</text>
|
<text text-anchor="start" x="-72.5" y="-45.8" font-family="Times,serif" font-size="14.00">handle_errors</text>
|
||||||
<text text-anchor="start" x="-72.5" y="-30.8" font-family="Times,serif" font-size="14.00">has_attribute</text>
|
<text text-anchor="start" x="-72.5" y="-30.8" font-family="Times,serif" font-size="14.00">has_attribute</text>
|
||||||
<text text-anchor="start" x="-72.5" y="-15.8" font-family="Times,serif" font-size="14.00">iptables_counter_update</text>
|
|
||||||
<text text-anchor="start" x="-72.5" y="-0.8" font-family="Times,serif" font-size="14.00">latin_only</text>
|
<text text-anchor="start" x="-72.5" y="-0.8" font-family="Times,serif" font-size="14.00">latin_only</text>
|
||||||
<text text-anchor="start" x="-72.5" y="14.2" font-family="Times,serif" font-size="14.00">mutually_exclusive</text>
|
<text text-anchor="start" x="-72.5" y="14.2" font-family="Times,serif" font-size="14.00">mutually_exclusive</text>
|
||||||
<text text-anchor="start" x="-72.5" y="29.2" font-family="Times,serif" font-size="14.00">optional</text>
|
<text text-anchor="start" x="-72.5" y="29.2" font-family="Times,serif" font-size="14.00">optional</text>
|
||||||
|
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
|
@ -1,5 +1,5 @@
|
||||||
class Array
|
class Array
|
||||||
def include_any? *args
|
def include_any?(*args)
|
||||||
(self & args).any?
|
(self & args).any?
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,14 +0,0 @@
|
||||||
require 'builder'
|
|
||||||
|
|
||||||
class Builder::XmlMarkup
|
|
||||||
def epp_head
|
|
||||||
self.instruct!
|
|
||||||
epp(
|
|
||||||
'xmlns' => 'https://epp.tld.ee/schema/epp-ee-1.0.xsd',
|
|
||||||
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
|
||||||
'xsi:schemaLocation' => 'lib/schemas/epp-ee-1.0.xsd'
|
|
||||||
) do
|
|
||||||
yield
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
14
lib/gem_ext/builder.rb
Normal file
14
lib/gem_ext/builder.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
module Builder
|
||||||
|
class XmlMarkup
|
||||||
|
def epp_head
|
||||||
|
instruct!
|
||||||
|
epp(
|
||||||
|
'xmlns' => 'https://epp.tld.ee/schema/epp-ee-1.0.xsd',
|
||||||
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
||||||
|
'xsi:schemaLocation' => 'lib/schemas/epp-ee-1.0.xsd'
|
||||||
|
) do
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
# Don't raise error when nil
|
# Don't raise error when nil
|
||||||
# http://stackoverflow.com/questions/9467034/rails-i18n-how-to-handle-case-of-a-nil-date-being-passed-ie-lnil
|
# http://stackoverflow.com/questions/9467034/rails-i18n-how-to-handle-case-of-a-nil-date-being-passed-ie-lnil
|
||||||
module I18n
|
module I18n
|
||||||
class << self
|
class << self
|
||||||
alias_method :original_localize, :localize
|
alias_method :original_localize, :localize
|
|
@ -8,7 +8,7 @@ end
|
||||||
# Store console and rake changes in versions
|
# Store console and rake changes in versions
|
||||||
if defined?(::Rails::Console)
|
if defined?(::Rails::Console)
|
||||||
PaperTrail.whodunnit = "console-#{`whoami`.strip}"
|
PaperTrail.whodunnit = "console-#{`whoami`.strip}"
|
||||||
elsif File.basename($PROGRAM_NAME) == "rake"
|
elsif File.basename($PROGRAM_NAME) == 'rake'
|
||||||
# rake username does not work when spring enabled
|
# rake username does not work when spring enabled
|
||||||
PaperTrail.whodunnit = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
|
PaperTrail.whodunnit = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
|
||||||
end
|
end
|
|
@ -1,17 +0,0 @@
|
||||||
module Iptable
|
|
||||||
def counter_update(registrar_code, ip)
|
|
||||||
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
|
|
||||||
|
|
||||||
begin
|
|
||||||
File.open(counter_proc, 'a') do |f|
|
|
||||||
f.puts "+#{ip}"
|
|
||||||
end
|
|
||||||
rescue Errno::ENOENT => e
|
|
||||||
logger.error "IPTABLES COUNTER UPDATE: cannot open #{counter_proc}: #{e}"
|
|
||||||
rescue Errno::EACCES => e
|
|
||||||
logger.error "IPTABLES COUNTER UPDATE: no permission #{counter_proc}: #{e}"
|
|
||||||
rescue IOError => e
|
|
||||||
logger.error "IPTABLES COUNTER UPDATE: cannot write #{ip} to #{counter_proc}: #{e}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -171,9 +171,7 @@ namespace :dev do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Setting.api_ip_whitelist_enabled = false
|
|
||||||
Setting.address_processing = false
|
Setting.address_processing = false
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
|
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
generate_default_data
|
generate_default_data
|
||||||
|
|
|
@ -10,6 +10,7 @@ FactoryBot.define do
|
||||||
email 'test@test.com'
|
email 'test@test.com'
|
||||||
country_code 'US'
|
country_code 'US'
|
||||||
accounting_customer_code 'test'
|
accounting_customer_code 'test'
|
||||||
|
language 'en'
|
||||||
|
|
||||||
factory :registrar_with_unlimited_balance do
|
factory :registrar_with_unlimited_balance do
|
||||||
after :create do |registrar|
|
after :create do |registrar|
|
||||||
|
|
|
@ -31,8 +31,6 @@ RSpec.feature 'Contact deletion in registrar area' do
|
||||||
background do
|
background do
|
||||||
allow(Depp::Contact).to receive(:find_by_id).and_return(FakeDeppContact.new)
|
allow(Depp::Contact).to receive(:find_by_id).and_return(FakeDeppContact.new)
|
||||||
allow(Depp::Contact).to receive(:new).and_return(FakeDeppContact.new)
|
allow(Depp::Contact).to receive(:new).and_return(FakeDeppContact.new)
|
||||||
Setting.api_ip_whitelist_enabled = false
|
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance, registrar: registrar))
|
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance, registrar: registrar))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.feature 'Registrar area IP restriction', settings: false do
|
RSpec.feature 'Registrar area IP restriction', settings: false do
|
||||||
background do
|
before do
|
||||||
Setting.registrar_ip_whitelist_enabled = true
|
@original_registrar_ip_whitelist_enabled = Setting.registrar_ip_whitelist_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Setting.registrar_ip_whitelist_enabled = @original_registrar_ip_whitelist_enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'notifies the user if his IP is not allowed' do
|
scenario 'notifies the user if his IP is not allowed' do
|
||||||
|
Setting.registrar_ip_whitelist_enabled = true
|
||||||
visit registrar_root_path
|
visit registrar_root_path
|
||||||
expect(page).to have_text('Access denied from IP 127.0.0.1')
|
expect(page).to have_text('Access denied from IP 127.0.0.1')
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,6 @@ RSpec.feature 'Registrar area linked users', settings: false do
|
||||||
username: 'new-user-name') }
|
username: 'new-user-name') }
|
||||||
|
|
||||||
background do
|
background do
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
sign_in_to_registrar_area(user: current_user)
|
sign_in_to_registrar_area(user: current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.feature 'Registrar area profile', settings: false do
|
RSpec.feature 'Registrar area profile', settings: false do
|
||||||
background do
|
background do
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
|
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ RSpec.feature 'Mobile ID login', db: true do
|
||||||
given!(:api_user) { create(:api_user, identity_code: 1234) }
|
given!(:api_user) { create(:api_user, identity_code: 1234) }
|
||||||
|
|
||||||
background do
|
background do
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
digidoc_client = instance_double(Digidoc::Client, authenticate: OpenStruct.new(user_id_code: 1234), session_code: 1234)
|
digidoc_client = instance_double(Digidoc::Client, authenticate: OpenStruct.new(user_id_code: 1234), session_code: 1234)
|
||||||
allow(Digidoc::Client).to receive(:new).and_return(digidoc_client)
|
allow(Digidoc::Client).to receive(:new).and_return(digidoc_client)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.feature 'Registrar area password sign-in' do
|
RSpec.feature 'Registrar area password sign-in' do
|
||||||
background do
|
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'signs in the user with valid credentials' do
|
scenario 'signs in the user with valid credentials' do
|
||||||
create(:api_user_with_unlimited_balance,
|
create(:api_user_with_unlimited_balance,
|
||||||
active: true,
|
active: true,
|
||||||
|
|
|
@ -2,7 +2,6 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.feature 'Registrar area sign-out', settings: false do
|
RSpec.feature 'Registrar area sign-out', settings: false do
|
||||||
background do
|
background do
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
|
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,14 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Authorization::RestrictedIP do
|
RSpec.describe Authorization::RestrictedIP do
|
||||||
describe '::enabled?', db: true, settings: false do
|
describe '::enabled?', db: true, settings: false do
|
||||||
|
before do
|
||||||
|
@original_registrar_ip_whitelist_enabled = Setting.registrar_ip_whitelist_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Setting.registrar_ip_whitelist_enabled = @original_registrar_ip_whitelist_enabled
|
||||||
|
end
|
||||||
|
|
||||||
context 'when "registrar_ip_whitelist_enabled" is true' do
|
context 'when "registrar_ip_whitelist_enabled" is true' do
|
||||||
before do
|
before do
|
||||||
Setting.registrar_ip_whitelist_enabled = true
|
Setting.registrar_ip_whitelist_enabled = true
|
||||||
|
@ -13,10 +21,6 @@ RSpec.describe Authorization::RestrictedIP do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when "registrar_ip_whitelist_enabled" is false' do
|
context 'when "registrar_ip_whitelist_enabled" is false' do
|
||||||
before do
|
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
end
|
|
||||||
|
|
||||||
specify do
|
specify do
|
||||||
expect(described_class).to_not be_enabled
|
expect(described_class).to_not be_enabled
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,30 +108,6 @@ RSpec.describe Domain do
|
||||||
@domain.registrant_update_confirmable?('123').should == false
|
@domain.registrant_update_confirmable?('123').should == false
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not find any domain pendings to clean' do
|
|
||||||
Domain.clean_expired_pendings.should == 0
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should not find any domains with wrong pendings' do
|
|
||||||
domain = create(:domain)
|
|
||||||
domain.registrant_verification_asked!('frame-str', '1')
|
|
||||||
domain.registrant_verification_asked_at = 30.days.ago
|
|
||||||
domain.save
|
|
||||||
|
|
||||||
Domain.clean_expired_pendings.should == 0
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should clean domain pendings' do
|
|
||||||
domain = create(:domain)
|
|
||||||
domain.registrant_verification_asked!('frame-str', '1')
|
|
||||||
domain.registrant_verification_asked_at = 30.days.ago
|
|
||||||
domain.pending_delete!
|
|
||||||
|
|
||||||
DomainCron.clean_expired_pendings.should == 1
|
|
||||||
domain.reload.pending_delete?.should == false
|
|
||||||
domain.pending_json.should == {}
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should expire domains' do
|
it 'should expire domains' do
|
||||||
Setting.expire_warning_period = 1
|
Setting.expire_warning_period = 1
|
||||||
Setting.redemption_grace_period = 1
|
Setting.redemption_grace_period = 1
|
||||||
|
@ -164,14 +140,6 @@ RSpec.describe Domain do
|
||||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should start redemption grace period' do
|
|
||||||
domain = create(:domain)
|
|
||||||
|
|
||||||
DomainCron.start_redemption_grace_period
|
|
||||||
domain.reload
|
|
||||||
domain.statuses.include?(DomainStatus::SERVER_HOLD).should == false
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with time period settings' do
|
context 'with time period settings' do
|
||||||
before :example do
|
before :example do
|
||||||
@save_days_to_renew = Setting.days_to_renew_domain_before_expire
|
@save_days_to_renew = Setting.days_to_renew_domain_before_expire
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe 'Registrar area IP restriction', settings: false do
|
RSpec.describe 'Registrar area IP restriction', settings: false do
|
||||||
|
before do
|
||||||
|
@original_registrar_ip_whitelist_enabled = Setting.registrar_ip_whitelist_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Setting.registrar_ip_whitelist_enabled = @original_registrar_ip_whitelist_enabled
|
||||||
|
end
|
||||||
|
|
||||||
context 'when authenticated' do
|
context 'when authenticated' do
|
||||||
before do
|
before do
|
||||||
sign_in_to_registrar_area
|
sign_in_to_registrar_area
|
||||||
|
@ -39,10 +47,6 @@ RSpec.describe 'Registrar area IP restriction', settings: false do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when IP restriction is disabled' do
|
context 'when IP restriction is disabled' do
|
||||||
before do
|
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
end
|
|
||||||
|
|
||||||
specify do
|
specify do
|
||||||
get registrar_root_url
|
get registrar_root_url
|
||||||
follow_redirect!
|
follow_redirect!
|
||||||
|
@ -77,10 +81,6 @@ RSpec.describe 'Registrar area IP restriction', settings: false do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when IP restriction is disabled' do
|
context 'when IP restriction is disabled' do
|
||||||
before do
|
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
end
|
|
||||||
|
|
||||||
specify do
|
specify do
|
||||||
get registrar_login_path
|
get registrar_login_path
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
|
|
|
@ -3,10 +3,6 @@ require 'rails_helper'
|
||||||
RSpec.describe 'Registrar area password sign-in', settings: false do
|
RSpec.describe 'Registrar area password sign-in', settings: false do
|
||||||
let!(:user) { create(:api_user, active: true, login: 'test', password: 'testtest') }
|
let!(:user) { create(:api_user, active: true, login: 'test', password: 'testtest') }
|
||||||
|
|
||||||
before do
|
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'signs the user in' do
|
it 'signs the user in' do
|
||||||
post registrar_sessions_path, depp_user: { tag: 'test', password: 'testtest' }
|
post registrar_sessions_path, depp_user: { tag: 'test', password: 'testtest' }
|
||||||
follow_redirect!
|
follow_redirect!
|
||||||
|
|
|
@ -2,7 +2,6 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe 'Registrar area sign-out', settings: false do
|
RSpec.describe 'Registrar area sign-out', settings: false do
|
||||||
before do
|
before do
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
sign_in_to_registrar_area
|
sign_in_to_registrar_area
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ RSpec.describe 'admin/billing/prices/_form' do
|
||||||
allow(view).to receive(:durations).and_return([])
|
allow(view).to receive(:durations).and_return([])
|
||||||
end
|
end
|
||||||
|
|
||||||
stub_template '_form_errors' => ''
|
stub_template '_form_errors.html.erb' => ''
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'price' do
|
describe 'price' do
|
||||||
|
|
|
@ -5,7 +5,7 @@ RSpec.describe 'admin/dns/zones/index' do
|
||||||
|
|
||||||
before :example do
|
before :example do
|
||||||
assign(:zones, zones)
|
assign(:zones, zones)
|
||||||
stub_template '_zone' => 'zone-row'
|
stub_template '_zone.html.erb' => 'zone-row'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has title' do
|
it 'has title' do
|
||||||
|
|
|
@ -13,8 +13,8 @@ RSpec.describe 'admin/domains/edit' do
|
||||||
|
|
||||||
assign(:domain, domain)
|
assign(:domain, domain)
|
||||||
|
|
||||||
stub_template '_form' => ''
|
stub_template '_form.html.erb' => ''
|
||||||
stub_template '_force_delete_dialog' => ''
|
stub_template '_force_delete_dialog.html.erb' => ''
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has force_delete_toggle_btn' do
|
it 'has force_delete_toggle_btn' do
|
||||||
|
|
|
@ -10,11 +10,11 @@ RSpec.describe 'registrar/contacts/_form' do
|
||||||
|
|
||||||
assign(:contact, contact)
|
assign(:contact, contact)
|
||||||
|
|
||||||
stub_template 'registrar/shared/_error_messages' => ''
|
stub_template 'registrar/shared/_error_messages.haml' => ''
|
||||||
stub_template 'registrar/contacts/form/_general' => ''
|
stub_template 'registrar/contacts/form/_general.html.haml' => ''
|
||||||
stub_template 'registrar/contacts/form/_address' => 'address info'
|
stub_template 'registrar/contacts/form/_address.html.haml' => 'address info'
|
||||||
stub_template 'registrar/contacts/form/_code' => ''
|
stub_template 'registrar/contacts/form/_code.html.haml' => ''
|
||||||
stub_template 'registrar/contacts/form/_legal_document' => ''
|
stub_template 'registrar/contacts/form/_legal_document.html.haml' => ''
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when address processing is enabled' do
|
context 'when address processing is enabled' do
|
||||||
|
|
|
@ -5,11 +5,11 @@ RSpec.describe 'registrar/contacts/show' do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
assign(:contact, contact)
|
assign(:contact, contact)
|
||||||
stub_template 'shared/_title' => ''
|
stub_template 'shared/_title.html.haml' => ''
|
||||||
stub_template 'registrar/contacts/partials/_general' => ''
|
stub_template 'registrar/contacts/partials/_general.html.haml' => ''
|
||||||
stub_template 'registrar/contacts/partials/_statuses' => ''
|
stub_template 'registrar/contacts/partials/_statuses.html.haml' => ''
|
||||||
stub_template 'registrar/contacts/partials/_domains' => ''
|
stub_template 'registrar/contacts/partials/_domains.html.haml' => ''
|
||||||
stub_template 'registrar/contacts/partials/_address' => 'address info'
|
stub_template 'registrar/contacts/partials/_address.html.haml' => 'address info'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when address processing is enabled' do
|
context 'when address processing is enabled' do
|
||||||
|
|
|
@ -10,10 +10,10 @@ RSpec.describe 'registrar/domains/_form' do
|
||||||
|
|
||||||
assign(:domain, domain)
|
assign(:domain, domain)
|
||||||
|
|
||||||
stub_template 'registrar/domains/form/_general' => ''
|
stub_template 'registrar/domains/form/_general.html.haml' => ''
|
||||||
stub_template 'registrar/domains/form/_contacts' => ''
|
stub_template 'registrar/domains/form/_contacts.html.haml' => ''
|
||||||
stub_template 'registrar/domains/form/_nameservers' => ''
|
stub_template 'registrar/domains/form/_nameservers.html.haml' => ''
|
||||||
stub_template 'registrar/domains/form/_dnskeys' => ''
|
stub_template 'registrar/domains/form/_dnskeys.html.haml' => ''
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has legal document' do
|
it 'has legal document' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue