Remove xml type from epp_request call #2660

This commit is contained in:
Martin Lensment 2015-05-29 10:43:48 +03:00
parent 2ecce2141e
commit 5953d3e5ea

View file

@ -24,7 +24,7 @@ describe 'EPP Session', epp: true do
it 'does not log in with invalid user' do it 'does not log in with invalid user' do
wrong_user = @epp_xml.session.login(clID: { value: 'wrong-user' }, pw: { value: 'ghyt9e4fu' }) wrong_user = @epp_xml.session.login(clID: { value: 'wrong-user' }, pw: { value: 'ghyt9e4fu' })
response = epp_plain_request(wrong_user, :xml) response = epp_plain_request(wrong_user)
response[:msg].should == 'Authentication error; server closing connection' response[:msg].should == 'Authentication error; server closing connection'
response[:result_code].should == '2501' response[:result_code].should == '2501'
response[:clTRID].should == 'ABC-12345' response[:clTRID].should == 'ABC-12345'
@ -35,14 +35,14 @@ describe 'EPP Session', epp: true do
Fabricate(:api_user, username: 'inactive-user', active: false, registrar: @registrar) Fabricate(:api_user, username: 'inactive-user', active: false, registrar: @registrar)
inactive = @epp_xml.session.login(clID: { value: 'inactive-user' }, pw: { value: 'ghyt9e4fu' }) inactive = @epp_xml.session.login(clID: { value: 'inactive-user' }, pw: { value: 'ghyt9e4fu' })
response = epp_plain_request(inactive, :xml) response = epp_plain_request(inactive)
response[:msg].should == 'Authentication error; server closing connection' response[:msg].should == 'Authentication error; server closing connection'
response[:result_code].should == '2501' response[:result_code].should == '2501'
end end
it 'prohibits further actions unless logged in' do it 'prohibits further actions unless logged in' do
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/domain-1.0.xsd')) @xsd = Nokogiri::XML::Schema(File.read('doc/schemas/domain-1.0.xsd'))
response = epp_plain_request(@epp_xml.domain.info(name: { value: 'test.ee' }), :xml) response = epp_plain_request(@epp_xml.domain.info(name: { value: 'test.ee' }))
response[:msg].should == 'You need to login first.' response[:msg].should == 'You need to login first.'
response[:result_code].should == '2002' response[:result_code].should == '2002'
response[:clTRID].should == 'ABC-12345' response[:clTRID].should == 'ABC-12345'
@ -51,13 +51,13 @@ describe 'EPP Session', epp: true do
it 'should not have clTRID in response if client does not send it' do it 'should not have clTRID in response if client does not send it' do
epp_xml_no_cltrid = EppXml.new(cl_trid: false) epp_xml_no_cltrid = EppXml.new(cl_trid: false)
wrong_user = epp_xml_no_cltrid.session.login(clID: { value: 'wrong-user' }, pw: { value: 'ghyt9e4fu' }) wrong_user = epp_xml_no_cltrid.session.login(clID: { value: 'wrong-user' }, pw: { value: 'ghyt9e4fu' })
response = epp_plain_request(wrong_user, :xml) response = epp_plain_request(wrong_user)
response[:clTRID].should be_nil response[:clTRID].should be_nil
end end
context 'with valid user' do context 'with valid user' do
it 'logs in epp user' do it 'logs in epp user' do
response = epp_plain_request(@login_xml_cache, :xml) response = epp_plain_request(@login_xml_cache)
response[:msg].should == 'Command completed successfully' response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000' response[:result_code].should == '1000'
response[:clTRID].should == 'ABC-12345' response[:clTRID].should == 'ABC-12345'
@ -69,12 +69,12 @@ describe 'EPP Session', epp: true do
end end
it 'does not log in twice' do it 'does not log in twice' do
response = epp_plain_request(@login_xml_cache, :xml) response = epp_plain_request(@login_xml_cache)
response[:msg].should == 'Command completed successfully' response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000' response[:result_code].should == '1000'
response[:clTRID].should == 'ABC-12345' response[:clTRID].should == 'ABC-12345'
response = epp_plain_request(@login_xml_cache, :xml) response = epp_plain_request(@login_xml_cache)
response[:msg].should match(/Already logged in. Use/) response[:msg].should match(/Already logged in. Use/)
response[:result_code].should == '2002' response[:result_code].should == '2002'
@ -86,10 +86,10 @@ describe 'EPP Session', epp: true do
it 'logs out epp user' do it 'logs out epp user' do
c = EppSession.count c = EppSession.count
epp_plain_request(@login_xml_cache, :xml) epp_plain_request(@login_xml_cache)
EppSession.count.should == c + 1 EppSession.count.should == c + 1
response = epp_plain_request(@epp_xml.session.logout, :xml) response = epp_plain_request(@epp_xml.session.logout)
response[:msg].should == 'Command completed successfully; ending session' response[:msg].should == 'Command completed successfully; ending session'
response[:result_code].should == '1500' response[:result_code].should == '1500'
@ -102,7 +102,7 @@ describe 'EPP Session', epp: true do
clID: { value: 'gitlab' }, clID: { value: 'gitlab' },
pw: { value: 'ghyt9e4fu' }, pw: { value: 'ghyt9e4fu' },
newPW: { value: 'abcdefg' } newPW: { value: 'abcdefg' }
), :xml) ))
response[:msg].should == 'Command completed successfully' response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000' response[:result_code].should == '1000'