mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Add basic keyrelay command, tests
This commit is contained in:
parent
1f5efa78ac
commit
ec721b69c0
10 changed files with 133 additions and 5 deletions
44
spec/epp/keyrelay_spec.rb
Normal file
44
spec/epp/keyrelay_spec.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe 'EPP Keyrelay', epp: true do
|
||||
let(:server_zone) { Epp::Server.new({ server: 'localhost', tag: 'zone', password: 'ghyt9e4fu', port: 701 }) }
|
||||
let(:server_elkdata) { Epp::Server.new({ server: 'localhost', tag: 'elkdata', password: 'ghyt9e4fu', port: 701 }) }
|
||||
let(:elkdata) { Fabricate(:registrar, { name: 'Elkdata', reg_no: '123' }) }
|
||||
let(:zone) { Fabricate(:registrar) }
|
||||
let(:domain) { Fabricate(:domain, name: 'example.ee', registrar: zone, dnskeys: [Fabricate.build(:dnskey)]) }
|
||||
|
||||
before(:each) { create_settings }
|
||||
|
||||
context 'with valid user' do
|
||||
before(:each) do
|
||||
Fabricate(:epp_user, username: 'zone', registrar: zone)
|
||||
Fabricate(:epp_user, username: 'elkdata', registrar: elkdata)
|
||||
end
|
||||
|
||||
it 'makes a keyrelay request' do
|
||||
xml = EppXml::Keyrelay.keyrelay({
|
||||
name: { value: 'example.ee' },
|
||||
keyData: {
|
||||
flags: { value: '256' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '8' },
|
||||
pubKey: { value: 'cmlraXN0aGViZXN0' }
|
||||
},
|
||||
authInfo: {
|
||||
pw: { value: domain.auth_info }
|
||||
},
|
||||
expiry: {
|
||||
relative: { value: 'P1M13D' }
|
||||
}
|
||||
})
|
||||
|
||||
response = epp_request(xml, :xml, :elkdata)
|
||||
|
||||
expect(response[:msg]).to eq('Command completed successfully')
|
||||
expect(response[:result_code]).to eq('1000')
|
||||
|
||||
expect(zone.messages.queued.count).to eq(1)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue