Refactor tests #2809

This commit is contained in:
Martin Lensment 2015-08-11 14:52:00 +03:00
parent 17c38362a2
commit 8c691542f0
3 changed files with 64 additions and 9 deletions

View file

@ -47,7 +47,7 @@
%th{class: 'col-xs-6'}= t(:setting) %th{class: 'col-xs-6'}= t(:setting)
%th{class: 'col-xs-6'}= t(:value) %th{class: 'col-xs-6'}= t(:value)
%tbody %tbody
= render 'setting_row', var: :transfer_wait_time /= render 'setting_row', var: :transfer_wait_time
= render 'setting_row', var: :ds_algorithm = render 'setting_row', var: :ds_algorithm
= render 'setting_row', var: :client_side_status_editing_enabled = render 'setting_row', var: :client_side_status_editing_enabled
= render 'setting_row', var: :api_ip_whitelist_enabled = render 'setting_row', var: :api_ip_whitelist_enabled

View file

@ -22,6 +22,7 @@ if con.present? && con.table_exists?('settings')
Setting.save_default(:ns_max_count, 11) Setting.save_default(:ns_max_count, 11)
Setting.save_default(:transfer_wait_time, 0) Setting.save_default(:transfer_wait_time, 0)
Setting.transfer_wait_time = 0
Setting.save_default(:request_confrimation_on_registrant_change_enabled, true) Setting.save_default(:request_confrimation_on_registrant_change_enabled, true)
Setting.save_default(:request_confirmation_on_domain_deletion_enabled, true) Setting.save_default(:request_confirmation_on_domain_deletion_enabled, true)

View file

@ -907,7 +907,6 @@ describe 'EPP Domain', epp: true do
context 'with valid domain' do context 'with valid domain' do
let(:domain) { Fabricate(:domain, registrar: @registrar1, dnskeys: []) } let(:domain) { Fabricate(:domain, registrar: @registrar1, dnskeys: []) }
### TRANSFER ###
it 'transfers a domain' do it 'transfers a domain' do
domain.registrar = @registrar1 domain.registrar = @registrar1
domain.save domain.save
@ -928,6 +927,67 @@ describe 'EPP Domain', epp: true do
old_contact_codes = domain.contacts.pluck(:code).sort.uniq old_contact_codes = domain.contacts.pluck(:code).sort.uniq
old_registrant_code = domain.registrant.code old_registrant_code = domain.registrant.code
login_as :registrar2 do
response = epp_plain_request(xml)
domain.reload
dtl = domain.domain_transfers.last
trn_data = response[:parsed].css('trnData')
trn_data.css('name').text.should == domain.name
trn_data.css('trStatus').text.should == 'serverApproved'
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('acID').text.should == 'REGDOMAIN1'
trn_data.css('acDate').text.should == dtl.transferred_at.in_time_zone.utc.utc.iso8601
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
domain.registrar.should == @registrar2
end
response = epp_plain_request(@epp_xml.session.poll)
response[:msg].should == 'Command completed successfully; ack to dequeue'
msg_q = response[:parsed].css('msgQ')
msg_q.css('qDate').text.should_not be_blank
msg_q.css('msg').text.should == "Domain transfer was approved, associated contacts were: " \
"#{old_contact_codes} and registrant was #{old_registrant_code}"
msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '1'
xml = @epp_xml.session.poll(poll: {
value: '', attrs: { op: 'ack', msgID: msg_q.first['id'] }
})
response = epp_plain_request(xml)
response[:msg].should == 'Command completed successfully'
msg_q = response[:parsed].css('msgQ')
msg_q.first['id'].should_not be_blank
msg_q.first['count'].should == '0'
end
### TRANSFER ###
# Do not place this test to epp-examples (epp: false)
it 'transfers a domain with wait time > 0', epp: false do
domain.registrar = @registrar1
domain.save
pw = domain.auth_info
xml = domain_transfer_xml({
name: { value: domain.name },
authInfo: { pw: { value: pw } }
}, 'request', {
_anonymus: [
legalDocument: {
value: 'dGVzdCBmYWlsCg==',
attrs: { type: 'pdf' }
}
]
})
old_contact_codes = domain.contacts.pluck(:code).sort.uniq
old_registrant_code = domain.registrant.code
response = login_as :registrar2 do response = login_as :registrar2 do
epp_plain_request(xml) epp_plain_request(xml)
end end
@ -1032,7 +1092,6 @@ describe 'EPP Domain', epp: true do
end end
it 'creates a domain transfer with legal document' do it 'creates a domain transfer with legal document' do
Setting.transfer_wait_time = 1
domain.legal_documents.count.should == 0 domain.legal_documents.count.should == 0
pw = domain.auth_info pw = domain.auth_info
xml = domain_transfer_xml({ xml = domain_transfer_xml({
@ -1066,11 +1125,6 @@ describe 'EPP Domain', epp: true do
response = login_as :registrar2 do response = login_as :registrar2 do
epp_plain_request(xml) epp_plain_request(xml)
end end
response[:result_code].should == '1000'
domain.legal_documents.count.should == 1 # does not add another legal documen
create_settings
end end
it 'creates transfer successfully without legal document' do it 'creates transfer successfully without legal document' do
@ -1568,7 +1622,7 @@ describe 'EPP Domain', epp: true do
response[:results][0][:result_code].should == '2303' response[:results][0][:result_code].should == '2303'
end end
it 'should allow querying domain transfer' do it 'should allow querying domain transfer', epp: false do
Setting.transfer_wait_time = 1 Setting.transfer_wait_time = 1
pw = domain.auth_info pw = domain.auth_info
xml = domain_transfer_xml({ xml = domain_transfer_xml({