Refactor EPP users to API users

This commit is contained in:
Martin Lensment 2015-01-29 14:13:49 +02:00
parent b8494993ea
commit c91c9c8ebf
44 changed files with 154 additions and 150 deletions

View file

@ -2,9 +2,9 @@ require 'rails_helper'
describe 'EPP Contact', epp: true do
before :all do
Fabricate(:epp_user)
Fabricate(:epp_user, username: 'registrar1', registrar: registrar1)
Fabricate(:epp_user, username: 'registrar2', registrar: registrar2)
Fabricate(:api_user)
Fabricate(:api_user, username: 'registrar1', registrar: registrar1)
Fabricate(:api_user, username: 'registrar2', registrar: registrar2)
login_as :gitlab
@ -68,7 +68,7 @@ describe 'EPP Contact', epp: true do
@contact = Contact.last
@contact.registrar.should == registrar1
registrar1.epp_users.should include(@contact.created_by)
registrar1.api_users.should include(@contact.created_by)
@contact.updated_by_id.should == nil
@contact.ident.should == '37605030299'
@contact.address.street.should == '123 Example'
@ -153,7 +153,7 @@ describe 'EPP Contact', epp: true do
context 'update command' do
before :all do
@contact =
@contact =
Fabricate(
:contact,
created_by_id: 1,
@ -212,11 +212,11 @@ describe 'EPP Contact', epp: true do
it 'updates disclosure items' do
Fabricate(
:contact,
:contact,
code: 'sh8013disclosure',
auth_info: '2fooBAR',
registrar: registrar1,
created_by_id: EppUser.first.id,
created_by_id: ApiUser.first.id,
disclosure: Fabricate(:contact_disclosure, phone: true, email: true))
xml = {
@ -245,7 +245,7 @@ describe 'EPP Contact', epp: true do
it 'deletes contact' do
@contact_deleted =
Fabricate(:contact, code: 'dwa1234', created_by_id: EppUser.first.id, registrar: registrar1)
Fabricate(:contact, code: 'dwa1234', created_by_id: ApiUser.first.id, registrar: registrar1)
response = epp_plain_request(delete_contact_xml({ id: { value: 'dwa1234' } }), :xml)
response[:msg].should == 'Command completed successfully'
@ -341,7 +341,7 @@ describe 'EPP Contact', epp: true do
end
# it 'returns auth error for non-owner with wrong password' do
# @contact = Fabricate(:contact,
# @contact = Fabricate(:contact,
# registrar: registrar2, code: 'info-4444', name: 'Johnny Awesome', auth_info: 'asde',
# address: Fabricate(:address), disclosure: Fabricate(:contact_disclosure, name: false))
@ -354,8 +354,8 @@ describe 'EPP Contact', epp: true do
context 'about disclose' do
# it 'discloses items with wrong password when queried by owner' do
# @contact = Fabricate(:contact,
# registrar: registrar1, code: 'info-4444',
# @contact = Fabricate(:contact,
# registrar: registrar1, code: 'info-4444',
# name: 'Johnny Awesome', auth_info: 'asde',
# address: Fabricate(:address), disclosure: Fabricate(:contact_disclosure, name: false))
@ -424,9 +424,9 @@ describe 'EPP Contact', epp: true do
# expect(response[:msg]).to eq('Required parameter missing: pw')
end
it 'does not display unassociated object with wrong password' do
it 'does not display unassociated object with wrong password' do
login_as :registrar2
xml = epp_xml.info(id: { value: @registrar1_contact.code },
xml = epp_xml.info(id: { value: @registrar1_contact.code },
authInfo: { pw: { value: 'wrong-pw' } })
response = epp_plain_request(xml, :xml)

View file

@ -12,8 +12,8 @@ describe 'EPP Domain', epp: true do
end
before(:all) do
Fabricate(:epp_user, username: 'registrar1', registrar: registrar1)
Fabricate(:epp_user, username: 'registrar2', registrar: registrar2)
Fabricate(:api_user, username: 'registrar1', registrar: registrar1)
Fabricate(:api_user, username: 'registrar2', registrar: registrar2)
login_as :registrar1

View file

@ -10,8 +10,8 @@ describe 'EPP Keyrelay', epp: true do
before(:all) do
@elkdata = Fabricate(:registrar, { name: 'Elkdata', reg_no: '123' })
@zone = Fabricate(:registrar)
Fabricate(:epp_user, username: 'zone', registrar: @zone)
Fabricate(:epp_user, username: 'elkdata', registrar: @elkdata)
Fabricate(:api_user, username: 'zone', registrar: @zone)
Fabricate(:api_user, username: 'elkdata', registrar: @elkdata)
@uniq_no = proc { @i ||= 0; @i += 1 }
end

View file

@ -12,8 +12,8 @@ describe 'EPP Poll', epp: true do
end
before(:all) do
Fabricate(:epp_user, username: 'registrar1', registrar: registrar1)
Fabricate(:epp_user, username: 'registrar2', registrar: registrar2)
Fabricate(:api_user, username: 'registrar1', registrar: registrar1)
Fabricate(:api_user, username: 'registrar2', registrar: registrar2)
login_as :registrar1

View file

@ -1,8 +1,8 @@
require 'rails_helper'
describe 'EPP Session', epp: true do
before :all do
@epp_user = Fabricate(:epp_user)
before :all do
@api_user = Fabricate(:api_user)
@epp_xml = EppXml.new(cl_trid: 'ABC-12345')
@login_xml_cache = @epp_xml.session.login(clID: { value: 'gitlab' }, pw: { value: 'ghyt9e4fu' })
@ -31,7 +31,7 @@ describe 'EPP Session', epp: true do
it 'does not log in with inactive user' do
@registrar = Fabricate(:registrar, { name: 'registrar1', reg_no: '123' })
Fabricate(:epp_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' })
response = epp_plain_request(inactive, :xml)
@ -73,12 +73,12 @@ describe 'EPP Session', epp: true do
it 'logs out epp user' do
epp_plain_request(@login_xml_cache, :xml)
EppSession.last[:epp_user_id].should == 1
EppSession.last[:api_user_id].should == 1
response = epp_plain_request(@epp_xml.session.logout, :xml)
response[:msg].should == 'Command completed successfully; ending session'
response[:result_code].should == '1500'
EppSession.last[:epp_user_id].should == nil
EppSession.last[:api_user_id].should == nil
end
end
end