Merge branch 'master' of github.com:internetee/registry

Conflicts:
	app/views/client/domain_versions/show.haml
This commit is contained in:
Andres Keskküla 2014-11-10 18:01:01 +02:00
commit 6aa82dd222
47 changed files with 138 additions and 1229 deletions

View file

@ -273,8 +273,16 @@ describe 'EPP Domain', epp: true do
it 'validates nameserver ipv4 when in same zone as domain' do
xml = domain_create_xml({
ns: [
{ hostObj: { value: 'ns1.example.ee' } },
{ hostObj: { value: 'ns2.example.ee' } }
{
hostAttr: [
{ hostName: { value: 'ns1.example.ee' } }
]
},
{
hostAttr: {
hostName: { value: 'ns2.example.ee' }
}
}
]
})
@ -319,7 +327,13 @@ describe 'EPP Domain', epp: true do
it 'does not create domain with too many nameservers' do
nameservers = []
14.times { |i| nameservers << { hostObj: { value: "ns#{i}.example.net" } } }
14.times do |i|
nameservers << {
hostAttr: {
hostName: { value: "ns#{i}.example.net" }
}
}
end
xml = domain_create_xml(ns: nameservers)
response = epp_request(xml, :xml)
@ -330,10 +344,17 @@ describe 'EPP Domain', epp: true do
it 'returns error when invalid nameservers are present' do
xml = domain_create_xml({
ns: [
{ hostObj: { value: 'invalid1-' } },
{ hostObj: { value: '-invalid2' } }
{
hostAttr: {
hostName: { value: 'invalid1-' }
}
},
{
hostAttr: {
hostName: { value: '-invalid2' }
}
}
]
})
response = epp_request(xml, :xml)
@ -341,8 +362,25 @@ describe 'EPP Domain', epp: true do
expect(response[:msg]).to eq('Hostname is invalid')
end
it 'does not allow hostObj' do
xml = domain_create_xml({
ns: [
{
hostObj: { value: 'ns1.example.ee' }
},
{
hostObj: { value: 'ns2.example.ee' }
}
]
})
response = epp_request(xml, :xml)
expect(response[:result_code]).to eq('2306')
expect(response[:msg]).to eq('hostObj object is not allowed')
end
it 'creates domain with nameservers with ips' do
epp_request('domains/create_w_host_attrs.xml')
epp_request(domain_create_with_host_attrs, :xml)
expect(Domain.first.nameservers.count).to eq(2)
ns = Domain.first.nameservers.first
expect(ns.ipv4).to eq('192.0.2.2')
@ -350,7 +388,7 @@ describe 'EPP Domain', epp: true do
end
it 'returns error when nameserver has invalid ips' do
response = epp_request('domains/create_w_invalid_ns_ip.xml')
response = epp_request(domain_create_with_invalid_ns_ip_xml, :xml)
expect(response[:results][0][:result_code]).to eq '2005'
expect(response[:results][0][:msg]).to eq 'IPv4 is invalid'
expect(response[:results][0][:value]).to eq '192.0.2.2.invalid'

View file

@ -1,30 +0,0 @@
<?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="y">1</domain:period>
<domain:ns>
<domain:hostAttr>
<domain:hostName>ns1.example.net</domain:hostName>
<domain:hostAddr ip="v4">192.0.2.2</domain:hostAddr>
<domain:hostAddr ip="v6">1080:0:0:0:8:800:200C:417A</domain:hostAddr>
</domain:hostAttr>
<domain:hostAttr>
<domain:hostName>ns2.example.net</domain:hostName>
</domain:hostAttr>
</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>

View file

@ -1,30 +0,0 @@
<?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="y">1</domain:period>
<domain:ns>
<domain:hostAttr>
<domain:hostName>ns1.example.net</domain:hostName>
<domain:hostAddr ip="v4">192.0.2.2.invalid</domain:hostAddr>
</domain:hostAttr>
<domain:hostAttr>
<domain:hostName>ns2.example.net</domain:hostName>
<domain:hostAddr ip="v6">invalid_ipv6</domain:hostAddr>
</domain:hostAttr>
</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>

View file

@ -15,7 +15,6 @@ feature 'Sessions', type: :feature do
scenario 'Admin logs in' do
visit root_path
expect(page).to have_button('ID card (gitlab)')
expect(page).to have_button('ID card (zone)')
click_on 'ID card (gitlab)'
expect(page).to have_text('Welcome!')
@ -26,22 +25,4 @@ feature 'Sessions', type: :feature do
expect(page).to have_link('Elkdata', count: 2)
expect(page).to have_link('Zone Media OÜ', count: 2)
end
scenario 'Client logs in' do
visit root_path
click_on 'ID card (zone)'
expect(page).to have_text('Welcome!')
uri = URI.parse(current_url)
expect(uri.path).to eq(client_root_path)
zone.domains.pluck(:name).each do |name|
expect(page).to have_link(name)
end
elkdata.domains.pluck(:name).each do |name|
expect(page).to_not have_link(name)
end
end
end

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Setting management', type: :feature do
let(:zone) { Fabricate(:registrar) }
let(:zone_user) { Fabricate(:user, registrar: zone, username: 'zone', admin: true, identity_code: '37810013087') }
let(:zone_user) { Fabricate(:user, registrar: zone, username: 'gitlab', admin: true, identity_code: '37810013087') }
background { create_settings }

View file

@ -64,13 +64,24 @@ module Epp
EppXml::Domain.info(xml_params)
end
# rubocop: disable Metrics/MethodLength
def domain_create_xml(xml_params = {}, dnssec_params = {})
defaults = {
name: { value: 'example.ee' },
period: { value: '1', attrs: { unit: 'y' } },
ns: [
{ hostObj: { value: 'ns1.example.net' } },
{ hostObj: { value: 'ns2.example.net' } }
{
hostAttr: [
{ hostName: { value: 'ns1.example.net' } },
{ hostAddr: { value: '192.0.2.2', attrs: { ip: 'v4' } } },
{ hostAddr: { value: '1080:0:0:0:8:800:200C:417A', attrs: { ip: 'v6' } } }
]
},
{
hostAttr: {
hostName: { value: 'ns2.example.net' }
}
}
],
registrant: { value: 'jd1234' },
_anonymus: [
@ -97,6 +108,70 @@ module Epp
EppXml::Domain.create(xml_params, dnssec_params)
end
def domain_create_with_invalid_ns_ip_xml
xml_params = {
name: { value: 'example.ee' },
period: { value: '1', attrs: { unit: 'y' } },
ns: [
{
hostAttr: {
hostName: { value: 'ns1.example.net' },
hostAddr: { value: '192.0.2.2.invalid', attrs: { ip: 'v4' } }
}
},
{
hostAttr: {
hostName: { value: 'ns2.example.net' },
hostAddr: { value: 'invalid_ipv6', attrs: { ip: 'v6' } }
}
}
],
registrant: { value: 'jd1234' },
contact: { value: 'sh8013', attrs: { type: 'admin' } },
contact: { value: 'sh8013', attrs: { type: 'tech' } },
contact: { value: 'sh801333', attrs: { type: 'tech' } },
authInfo: {
pw: {
value: '2fooBAR'
}
}
}
EppXml::Domain.create(xml_params, false)
end
def domain_create_with_host_attrs
xml_params = {
name: { value: 'example.ee' },
period: { value: '1', attrs: { unit: 'y' } },
ns: [
{
hostAttr: [
{ hostName: { value: 'ns1.example.net' } },
{ hostAddr: { value: '192.0.2.2', attrs: { ip: 'v4' } } },
{ hostAddr: { value: '1080:0:0:0:8:800:200C:417A', attrs: { ip: 'v6' } } }
]
},
{
hostAttr: {
hostName: { value: 'ns2.example.net' }
}
}
],
registrant: { value: 'jd1234' },
contact: { value: 'sh8013', attrs: { type: 'admin' } },
contact: { value: 'sh8013', attrs: { type: 'tech' } },
contact: { value: 'sh801333', attrs: { type: 'tech' } },
authInfo: {
pw: {
value: '2fooBAR'
}
}
}
EppXml::Domain.create(xml_params, false)
end
def domain_update_xml(xml_params = {}, dnssec_params = false)
defaults = {
name: { value: 'example.ee' }

View file

@ -2,8 +2,6 @@ module Feature
def sign_in(user)
visit '/logout'
click_on 'ID card (gitlab)' if user.username == 'gitlab'
click_on 'ID card (zone)' if user.username == 'zone'
click_on 'ID card (elkdata)' if user.username == 'elkdata'
end
end