mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Domain checking for single domain
This commit is contained in:
parent
cd52da3f8f
commit
9c9ff71e1e
4 changed files with 18 additions and 2 deletions
|
@ -6,7 +6,9 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
def check_domain
|
def check_domain
|
||||||
cp = command_params_for('check')
|
cp = command_params_for('check')
|
||||||
|
|
||||||
@domain = cp[:name]
|
@domain = cp[:name]
|
||||||
|
@avail = Domain.find_by(name: @domain) ? '0' : '1'
|
||||||
|
|
||||||
render '/epp/domains/check'
|
render '/epp/domains/check'
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ xml.epp_head do
|
||||||
xml.resData do
|
xml.resData do
|
||||||
xml.tag!('domain:chkData', 'xmlns:domain' => 'http://www.nic.cz/xml/epp/domain-1.4', 'xsi:schemaLocation' => 'http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd') do
|
xml.tag!('domain:chkData', 'xmlns:domain' => 'http://www.nic.cz/xml/epp/domain-1.4', 'xsi:schemaLocation' => 'http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd') do
|
||||||
xml.tag!('domain:cd') do
|
xml.tag!('domain:cd') do
|
||||||
xml.tag!('domain:name', @domain, 'avail' => 1)
|
xml.tag!('domain:name', @domain, 'avail' => @avail)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,7 @@ describe 'EPP Domain', epp: true do
|
||||||
context 'with valid user' do
|
context 'with valid user' do
|
||||||
before(:each) { Fabricate(:epp_user) }
|
before(:each) { Fabricate(:epp_user) }
|
||||||
|
|
||||||
|
# incomplete
|
||||||
it 'creates a domain' do
|
it 'creates a domain' do
|
||||||
response = epp_request('domains/create.xml')
|
response = epp_request('domains/create.xml')
|
||||||
expect(response[:result_code]).to eq('1000')
|
expect(response[:result_code]).to eq('1000')
|
||||||
|
@ -14,10 +15,22 @@ describe 'EPP Domain', epp: true do
|
||||||
expect(Domain.first.registrar.name).to eq('Zone Media OÜ')
|
expect(Domain.first.registrar.name).to eq('Zone Media OÜ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# incomplete
|
||||||
it 'checks domain' do
|
it 'checks domain' do
|
||||||
response = epp_request('domains/check.xml')
|
response = epp_request('domains/check.xml')
|
||||||
expect(response[:result_code]).to eq('1000')
|
expect(response[:result_code]).to eq('1000')
|
||||||
expect(response[:msg]).to eq('Command completed successfully')
|
expect(response[:msg]).to eq('Command completed successfully')
|
||||||
|
|
||||||
|
domain = response[:parsed].css('resData chkData cd name').first
|
||||||
|
expect(domain.text).to eq('test.ee')
|
||||||
|
expect(domain[:avail]).to eq('1')
|
||||||
|
|
||||||
|
Fabricate(:domain, name: 'test.ee')
|
||||||
|
|
||||||
|
response = epp_request('domains/check.xml')
|
||||||
|
domain = response[:parsed].css('resData chkData cd name').first
|
||||||
|
expect(domain.text).to eq('test.ee')
|
||||||
|
expect(domain[:avail]).to eq('0')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,8 @@ module Epp
|
||||||
{
|
{
|
||||||
result_code: res.css('epp response result').first[:code],
|
result_code: res.css('epp response result').first[:code],
|
||||||
msg: res.css('epp response result msg').text,
|
msg: res.css('epp response result msg').text,
|
||||||
clTRID: res.css('epp trID clTRID').text
|
clTRID: res.css('epp trID clTRID').text,
|
||||||
|
parsed: res.remove_namespaces!
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue