Introduce request op to domain transfer #2746

This commit is contained in:
Martin Lensment 2015-07-10 15:42:14 +03:00
parent 6daf082129
commit c4da9c86a6
5 changed files with 121 additions and 10 deletions

View file

@ -839,7 +839,7 @@ describe 'EPP Domain', epp: true do
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'query', {
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
@ -887,7 +887,7 @@ describe 'EPP Domain', epp: true do
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'query', {
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
@ -965,7 +965,7 @@ describe 'EPP Domain', epp: true do
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'query', {
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
@ -1401,7 +1401,7 @@ describe 'EPP Domain', epp: true do
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: 'test' } }
}, 'query', {
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
@ -1415,12 +1415,12 @@ describe 'EPP Domain', epp: true do
response[:msg].should == 'Authorization error'
end
it 'ignores transfer wha registrant registrar requests transfer' do
it 'ignores transfer when domain already belongs to registrar' do
pw = domain.auth_info
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'query', {
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
@ -1446,7 +1446,7 @@ describe 'EPP Domain', epp: true do
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'query', {
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
@ -1482,6 +1482,114 @@ describe 'EPP Domain', epp: true do
response[:result_code].should == '2303'
end
it 'should not return transfers when there are none' do
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: domain.auth_info } }
}, 'query')
response = epp_plain_request(xml)
response[:results][0][:msg].should == 'No transfers found'
response[:results][0][:result_code].should == '2303'
end
it 'should allow querying domain transfer' do
Setting.transfer_wait_time = 1
pw = domain.auth_info
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
attrs: { type: 'pdf' }
}
]
})
login_as :registrar2 do
response = epp_plain_request(xml)
response[:results][0][:msg].should == 'Command completed successfully'
response[:results][0][:result_code].should == '1000'
trn_data = response[:parsed].css('trnData')
dtl = domain.domain_transfers.last
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'pending'
trn_data.css('reID').text.should == 'REGDOMAIN2'
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
trn_data.css('acDate').text.should == dtl.wait_until.in_time_zone.utc.utc.iso8601
trn_data.css('acID').text.should == 'REGDOMAIN1'
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'query')
response = epp_plain_request(xml)
response[:results][0][:msg].should == 'Command completed successfully'
response[:results][0][:result_code].should == '1000'
trn_data = response[:parsed].css('trnData')
dtl = domain.domain_transfers.last
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'pending'
trn_data.css('reID').text.should == 'REGDOMAIN2'
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
trn_data.css('acDate').text.should == dtl.wait_until.in_time_zone.utc.utc.iso8601
trn_data.css('acID').text.should == 'REGDOMAIN1'
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
end
# approves pending transfer
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'approve', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
attrs: { type: 'pdf' }
}
]
})
response = epp_plain_request(xml)
response[:results][0][:msg].should == 'Command completed successfully'
response[:results][0][:result_code].should == '1000'
# query should return last completed transfer
domain.reload
pw = domain.auth_info
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'query')
response = epp_plain_request(xml)
response[:results][0][:msg].should == 'Command completed successfully'
response[:results][0][:result_code].should == '1000'
trn_data = response[:parsed].css('trnData')
dtl = domain.domain_transfers.last
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'clientApproved'
trn_data.css('reID').text.should == 'REGDOMAIN2'
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
trn_data.css('acDate').text.should == dtl.transferred_at.in_time_zone.utc.utc.iso8601
trn_data.css('acID').text.should == 'REGDOMAIN1'
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
Setting.transfer_wait_time = 0
end
### UPDATE ###
it 'should update right away without update pending status' do
existing_pw = domain.auth_info