mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Feature tests for ip whitelist
This commit is contained in:
parent
ae746be970
commit
292590cbbf
4 changed files with 69 additions and 5 deletions
|
@ -225,6 +225,9 @@ en:
|
||||||
state: 'State / Province'
|
state: 'State / Province'
|
||||||
deposit:
|
deposit:
|
||||||
amount: 'Amount'
|
amount: 'Amount'
|
||||||
|
white_ip:
|
||||||
|
ipv4: 'IPv4'
|
||||||
|
ipv6: 'IPv6'
|
||||||
|
|
||||||
errors:
|
errors:
|
||||||
messages:
|
messages:
|
||||||
|
@ -560,8 +563,6 @@ en:
|
||||||
code: 'Code'
|
code: 'Code'
|
||||||
nameservers: 'Nameservers'
|
nameservers: 'Nameservers'
|
||||||
hostname: 'Hostname'
|
hostname: 'Hostname'
|
||||||
ipv4: 'IPv4'
|
|
||||||
ipv6: 'IPv6'
|
|
||||||
dnskeys: 'DNS Keys'
|
dnskeys: 'DNS Keys'
|
||||||
flag: 'Flag'
|
flag: 'Flag'
|
||||||
protocol: 'Protocol'
|
protocol: 'Protocol'
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150519102521) do
|
ActiveRecord::Schema.define(version: 20150519140853) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
|
@ -15,14 +15,14 @@ feature 'Api users', type: :feature do
|
||||||
|
|
||||||
it 'should redirect to login path' do
|
it 'should redirect to login path' do
|
||||||
visit admin_api_user_url(@api_user)
|
visit admin_api_user_url(@api_user)
|
||||||
|
|
||||||
current_path.should == '/admin/login'
|
current_path.should == '/admin/login'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as logged in user' do
|
context 'as logged in user' do
|
||||||
it 'should show index of contacts' do
|
it 'should show index of api users' do
|
||||||
sign_in @user
|
sign_in @user
|
||||||
visit admin_api_users_url
|
visit admin_api_users_url
|
||||||
|
|
||||||
|
|
63
spec/features/admin/white_ip_spec.rb
Normal file
63
spec/features/admin/white_ip_spec.rb
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
feature 'Api users', type: :feature do
|
||||||
|
before :all do
|
||||||
|
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
|
||||||
|
@registrar = Fabricate(:registrar)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'as unknown user' do
|
||||||
|
it 'should redirect to login path' do
|
||||||
|
visit new_admin_registrar_white_ip_url(@registrar)
|
||||||
|
|
||||||
|
current_path.should == '/admin/login'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'as logged in user' do
|
||||||
|
before { sign_in @user }
|
||||||
|
|
||||||
|
it 'should add new white ip to registrar' do
|
||||||
|
visit admin_registrar_url(@registrar)
|
||||||
|
|
||||||
|
page.should_not have_text('192.168.1.1')
|
||||||
|
|
||||||
|
click_link 'Create new white IP'
|
||||||
|
|
||||||
|
fill_in 'IPv4', with: '192.168.1.1'
|
||||||
|
fill_in 'IPv6', with: 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329'
|
||||||
|
select 'REPP', from: 'Interface'
|
||||||
|
click_button 'Save'
|
||||||
|
|
||||||
|
page.should have_text('Record created')
|
||||||
|
page.should have_text('White IP')
|
||||||
|
page.should have_link(@registrar.to_s)
|
||||||
|
page.should have_text('192.168.1.1')
|
||||||
|
page.should have_text('FE80:0000:0000:0000:0202:B3FF:FE1E:8329')
|
||||||
|
page.should have_text('REPP')
|
||||||
|
|
||||||
|
click_link @registrar.to_s
|
||||||
|
|
||||||
|
current_path.should == "/admin/registrars/#{@registrar.id}"
|
||||||
|
page.should have_text('192.168.1.1')
|
||||||
|
page.should have_text('FE80:0000:0000:0000:0202:B3FF:FE1E:8329')
|
||||||
|
page.should have_text('REPP')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not add invalid ip to registrar' do
|
||||||
|
visit new_admin_registrar_white_ip_url(@registrar)
|
||||||
|
|
||||||
|
click_button 'Save'
|
||||||
|
page.should have_text('IPv4 or IPv6 must be present')
|
||||||
|
page.should have_text('Failed to create record')
|
||||||
|
|
||||||
|
fill_in 'IPv4', with: 'bla'
|
||||||
|
fill_in 'IPv6', with: 'bla'
|
||||||
|
|
||||||
|
click_button 'Save'
|
||||||
|
|
||||||
|
page.should have_text('IPv4 is invalid')
|
||||||
|
page.should have_text('IPv6 is invalid')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue