mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 11:11:11 +02:00
Renew with invalid exp date test
This commit is contained in:
parent
e18ca330a0
commit
3256534f0d
4 changed files with 27 additions and 7 deletions
|
@ -30,8 +30,7 @@ module Epp::DomainsHelper
|
|||
if @domain.renew(ph[:curExpDate], ph[:period])
|
||||
render '/epp/domains/renew'
|
||||
else
|
||||
handle_errors
|
||||
render '/epp/error'
|
||||
handle_errors(@domain)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,9 +5,10 @@ class Domain < ActiveRecord::Base
|
|||
include EppErrors
|
||||
|
||||
EPP_CODE_MAP = {
|
||||
'2302' => ['Domain name already exists', 'Domain name is reserved or restricted'],
|
||||
'2306' => ['Registrant is missing', 'Nameservers count must be between 1-13', 'Admin contact is missing'],
|
||||
'2303' => ['Contact was not found']
|
||||
'2302' => ['Domain name already exists', 'Domain name is reserved or restricted'], # Object exists
|
||||
'2306' => ['Registrant is missing', 'Admin contact is missing', 'Given and current expire dates do not match'], # Parameter policy error
|
||||
'2004' => ['Nameservers count must be between 1-13'], # Parameter value range error
|
||||
'2303' => ['Contact was not found'] # Object does not exist
|
||||
}
|
||||
|
||||
EPP_OBJ = 'domain'
|
||||
|
|
|
@ -69,13 +69,13 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
it 'does not create domain without nameservers' do
|
||||
response = epp_request('domains/create_wo_nameservers.xml')
|
||||
expect(response[:result_code]).to eq('2306')
|
||||
expect(response[:result_code]).to eq('2004')
|
||||
expect(response[:msg]).to eq('Nameservers count must be between 1-13')
|
||||
end
|
||||
|
||||
it 'does not create domain with too many nameservers' do
|
||||
response = epp_request('domains/create_w_too_many_nameservers.xml')
|
||||
expect(response[:result_code]).to eq('2306')
|
||||
expect(response[:result_code]).to eq('2004')
|
||||
expect(response[:msg]).to eq('Nameservers count must be between 1-13')
|
||||
end
|
||||
|
||||
|
@ -141,6 +141,12 @@ describe 'EPP Domain', epp: true do
|
|||
expect(exDate).to eq ('2015-08-07 00:00:00 UTC')
|
||||
expect(name).to eq ('example.ee')
|
||||
end
|
||||
|
||||
it 'returns an error when given and current exp dates do not match' do
|
||||
response = epp_request('domains/renew_w_not_matching_exp_dates.xml')
|
||||
expect(response[:results][0][:result_code]).to eq('2306')
|
||||
expect(response[:results][0][:msg]).to eq('Given and current expire dates do not match')
|
||||
end
|
||||
end
|
||||
|
||||
it 'checks a domain' do
|
||||
|
|
14
spec/epp/requests/domains/renew_w_not_matching_exp_dates.xml
Normal file
14
spec/epp/requests/domains/renew_w_not_matching_exp_dates.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<renew>
|
||||
<domain:renew
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.ee</domain:name>
|
||||
<domain:curExpDate>2016-08-07</domain:curExpDate>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
</domain:renew>
|
||||
</renew>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue