mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +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
|
||||
|
||||
def write_to_epp_log
|
||||
request_command = params[:command] || params[:action] # error receives :command, other methods receive :action
|
||||
ApiLog::EppLog.create({
|
||||
request: params[:raw_frame],
|
||||
request_command: params[:action],
|
||||
request: params[:raw_frame] || params[:frame],
|
||||
request_command: request_command,
|
||||
request_successful: epp_errors.empty?,
|
||||
request_object: params[:epp_object_type], # TODO: fix this for login and logout
|
||||
response: @response,
|
||||
|
|
|
@ -8,10 +8,11 @@ class EppConstraint
|
|||
@type = type
|
||||
end
|
||||
|
||||
# creates parsed_frame, detects epp request object
|
||||
def matches?(request)
|
||||
parsed_frame = Nokogiri::XML(request.params[:raw_frame])
|
||||
|
||||
unless [:keyrelay].include?(@type)
|
||||
unless [:keyrelay, :poll].include?(@type)
|
||||
element = "//#{@type}:#{request.params[:action]}"
|
||||
return false if parsed_frame.xpath("#{element}", OBJECT_TYPES[@type]).none?
|
||||
end
|
||||
|
@ -24,13 +25,13 @@ end
|
|||
|
||||
Rails.application.routes.draw 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: '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)
|
||||
|
||||
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'
|
||||
end
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ describe 'EPP Poll', epp: true do
|
|||
expect(log[1].api_user_registrar).to eq('Registrar OÜ')
|
||||
|
||||
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].api_user_name).to eq('zone')
|
||||
expect(log[2].api_user_registrar).to eq('Registrar OÜ')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue