mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Add a new test to period
This commit is contained in:
parent
47be521a9d
commit
7cd2d1aec4
3 changed files with 32 additions and 1 deletions
|
@ -173,7 +173,7 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def convert_period_to_time(period, unit)
|
def convert_period_to_time(period, unit)
|
||||||
return period.to_i.days if unit == 'd'
|
return period.to_i.days if unit == 'd'
|
||||||
return period.to_i.months if unit == 'm'
|
return period.to_i.months if unit == 'm'
|
||||||
return period.to_i.years if unit == 'y'
|
return period.to_i.years if unit == 'y'
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,6 +108,13 @@ describe 'EPP Domain', epp: true do
|
||||||
expect(response[:msg]).to eq('Command completed successfully')
|
expect(response[:msg]).to eq('Command completed successfully')
|
||||||
expect(Domain.first.valid_to).to eq(Date.today + 1.year)
|
expect(Domain.first.valid_to).to eq(Date.today + 1.year)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not create a domain with invalid period' do
|
||||||
|
response = epp_request('domains/create_w_invalid_period.xml')
|
||||||
|
expect(response[:results][0][:result_code]).to eq('2004')
|
||||||
|
expect(response[:results][0][:msg]).to eq('Period must add up to 1, 2 or 3 years')
|
||||||
|
expect(response[:results][0][:value]).to eq('843')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with juridical persion as an owner' do
|
context 'with juridical persion as an owner' do
|
||||||
|
|
24
spec/epp/requests/domains/create_w_invalid_period.xml
Normal file
24
spec/epp/requests/domains/create_w_invalid_period.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<create>
|
||||||
|
<domain:create
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>example.ee</domain:name>
|
||||||
|
<domain:period unit="d">843</domain:period>
|
||||||
|
<domain:ns>
|
||||||
|
<domain:hostObj>ns1.example.net</domain:hostObj>
|
||||||
|
<domain:hostObj>ns2.example.net</domain:hostObj>
|
||||||
|
</domain:ns>
|
||||||
|
<domain:registrant>jd1234</domain:registrant>
|
||||||
|
<domain:contact type="admin">sh8013</domain:contact>
|
||||||
|
<domain:contact type="tech">sh8013</domain:contact>
|
||||||
|
<domain:contact type="tech">sh801333</domain:contact>
|
||||||
|
<domain:authInfo>
|
||||||
|
<domain:pw>2fooBAR</domain:pw>
|
||||||
|
</domain:authInfo>
|
||||||
|
</domain:create>
|
||||||
|
</create>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue