mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Epp User login
This commit is contained in:
parent
76ec918426
commit
e20b138644
12 changed files with 106 additions and 8 deletions
|
@ -15,13 +15,43 @@ describe 'EPP Session', type: :epp do
|
|||
before(:each) { server.open_connection }
|
||||
after(:each) { server.close_connection }
|
||||
|
||||
it 'logs in epp user' do
|
||||
it 'does not log in with invalid user' do
|
||||
response = Nokogiri::XML(server.send_request(read_body('login.xml')))
|
||||
result = response.css('epp response result').first
|
||||
expect(result[:code]).to eq('2501')
|
||||
|
||||
msg = response.css('epp response result msg').text
|
||||
expect(msg).to eq('Authentication error; server closing connection')
|
||||
|
||||
Fabricate(:epp_user, active: false)
|
||||
|
||||
response = Nokogiri::XML(server.send_request(read_body('login.xml')))
|
||||
result = response.css('epp response result').first
|
||||
expect(result[:code]).to eq('2501')
|
||||
end
|
||||
|
||||
it 'logs in epp user' do
|
||||
Fabricate(:epp_user)
|
||||
|
||||
response = Nokogiri::XML(server.send_request(read_body('login.xml')))
|
||||
|
||||
result = response.css('epp response result').first
|
||||
expect(result[:code]).to eq('1000')
|
||||
|
||||
msg = response.css('epp response result msg').text
|
||||
expect(msg).to eq('User test was authenticated. Welcome.')
|
||||
expect(msg).to eq('Command completed successfully')
|
||||
end
|
||||
|
||||
it 'does not log in twice' do
|
||||
Fabricate(:epp_user)
|
||||
server.send_request(read_body('login.xml'))
|
||||
response = Nokogiri::XML(server.send_request(read_body('login.xml')))
|
||||
|
||||
result = response.css('epp response result').first
|
||||
expect(result[:code]).to eq('2002')
|
||||
|
||||
msg = response.css('epp response result msg').text
|
||||
expect(msg).to match(/Already logged in. Use/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
5
spec/fabricators/epp_user_fabricator.rb
Normal file
5
spec/fabricators/epp_user_fabricator.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
Fabricator(:epp_user) do
|
||||
username 'test'
|
||||
password 'test'
|
||||
active true
|
||||
end
|
5
spec/models/epp_user_spec.rb
Normal file
5
spec/models/epp_user_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
require "rails_helper"
|
||||
|
||||
describe EppUser do
|
||||
it { should belong_to(:registrar) }
|
||||
end
|
|
@ -4,4 +4,5 @@ describe Registrar do
|
|||
it { should belong_to(:country) }
|
||||
it { should have_many(:domains) }
|
||||
it { should have_many(:ns_sets) }
|
||||
it { should have_many(:epp_users) }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue