mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Test fixes
This commit is contained in:
parent
07c3a58c26
commit
fe74c0bd64
3 changed files with 9 additions and 7 deletions
|
@ -120,9 +120,10 @@ module Epp::Common
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_to_epp_log
|
def write_to_epp_log
|
||||||
|
request_command = params[:command] || params[:action] # error receives :command, other methods receive :action
|
||||||
ApiLog::EppLog.create({
|
ApiLog::EppLog.create({
|
||||||
request: params[:raw_frame],
|
request: params[:raw_frame] || params[:frame],
|
||||||
request_command: params[:action],
|
request_command: request_command,
|
||||||
request_successful: epp_errors.empty?,
|
request_successful: epp_errors.empty?,
|
||||||
request_object: params[:epp_object_type], # TODO: fix this for login and logout
|
request_object: params[:epp_object_type], # TODO: fix this for login and logout
|
||||||
response: @response,
|
response: @response,
|
||||||
|
|
|
@ -8,10 +8,11 @@ class EppConstraint
|
||||||
@type = type
|
@type = type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# creates parsed_frame, detects epp request object
|
||||||
def matches?(request)
|
def matches?(request)
|
||||||
parsed_frame = Nokogiri::XML(request.params[:raw_frame])
|
parsed_frame = Nokogiri::XML(request.params[:raw_frame])
|
||||||
|
|
||||||
unless [:keyrelay].include?(@type)
|
unless [:keyrelay, :poll].include?(@type)
|
||||||
element = "//#{@type}:#{request.params[:action]}"
|
element = "//#{@type}:#{request.params[:action]}"
|
||||||
return false if parsed_frame.xpath("#{element}", OBJECT_TYPES[@type]).none?
|
return false if parsed_frame.xpath("#{element}", OBJECT_TYPES[@type]).none?
|
||||||
end
|
end
|
||||||
|
@ -24,13 +25,13 @@ end
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
namespace(:epp, defaults: { format: :xml }) do
|
namespace(:epp, defaults: { format: :xml }) do
|
||||||
|
match 'session/:action', controller: 'sessions', via: :all
|
||||||
|
|
||||||
post 'command/:action', controller: 'domains', constraints: EppConstraint.new(:domain)
|
post 'command/:action', controller: 'domains', constraints: EppConstraint.new(:domain)
|
||||||
post 'command/:action', controller: 'contacts', constraints: EppConstraint.new(:contact)
|
post 'command/:action', controller: 'contacts', constraints: EppConstraint.new(:contact)
|
||||||
post 'command/poll', to: 'polls#poll'
|
post 'command/poll', to: 'polls#poll', constraints: EppConstraint.new(:poll)
|
||||||
post 'command/keyrelay', to: 'keyrelays#keyrelay', constraints: EppConstraint.new(:keyrelay)
|
post 'command/keyrelay', to: 'keyrelays#keyrelay', constraints: EppConstraint.new(:keyrelay)
|
||||||
|
|
||||||
match 'session/:action', controller: 'sessions', via: :all
|
|
||||||
# match 'command/:command', to: 'commands#proxy', defaults: { format: :xml }, via: [:post, :get]
|
|
||||||
get 'error/:command', to: 'errors#error'
|
get 'error/:command', to: 'errors#error'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ describe 'EPP Poll', epp: true do
|
||||||
expect(log[1].api_user_registrar).to eq('Registrar OÜ')
|
expect(log[1].api_user_registrar).to eq('Registrar OÜ')
|
||||||
|
|
||||||
expect(log[2].request_command).to eq('poll')
|
expect(log[2].request_command).to eq('poll')
|
||||||
expect(log[2].request_object).to eq(nil)
|
expect(log[2].request_object).to eq('poll')
|
||||||
expect(log[2].request_successful).to eq(true)
|
expect(log[2].request_successful).to eq(true)
|
||||||
expect(log[2].api_user_name).to eq('zone')
|
expect(log[2].api_user_name).to eq('zone')
|
||||||
expect(log[2].api_user_registrar).to eq('Registrar OÜ')
|
expect(log[2].api_user_registrar).to eq('Registrar OÜ')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue