mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
parent
3cca4c78cc
commit
c88d21ab1d
55 changed files with 16 additions and 7287 deletions
|
@ -1,45 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Account activity', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
r = Fabricate(:registrar)
|
||||
Fabricate.times(5, :account_activity, account: r.cash_account)
|
||||
Fabricate(:account_activity, account: r.cash_account, description: 'acc activity test', sum: -12)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
it 'should redirect to sign in page' do
|
||||
visit '/admin/account_activities'
|
||||
current_path.should == '/admin/login'
|
||||
page.should have_text('You need to sign in or sign up')
|
||||
end
|
||||
end
|
||||
|
||||
context 'as signed in user' do
|
||||
before do
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
it 'should navigate to account activities page' do
|
||||
visit admin_account_activities_path
|
||||
page.should have_text('+110.0 EUR', count: 5)
|
||||
page.should have_text('-12.0 EUR')
|
||||
end
|
||||
|
||||
it 'should search activities by description' do
|
||||
visit admin_account_activities_path
|
||||
fill_in 'Description', with: 'test'
|
||||
find('.btn.btn-default.search').click
|
||||
page.should have_text('-12.0 EUR')
|
||||
page.should_not have_text('+110.0 EUR')
|
||||
end
|
||||
|
||||
it 'should download csv' do
|
||||
visit admin_account_activities_path
|
||||
click_link 'Export CSV'
|
||||
response_headers['Content-Type'].should == 'text/csv'
|
||||
response_headers['Content-Disposition'].should match(/attachment; filename="account_activities_\d+\.csv"/)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,49 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Admin users', type: :feature do
|
||||
before :all do
|
||||
@admin_user = Fabricate(:admin_user)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
it 'should redirect to login path' do
|
||||
visit admin_admin_users_url
|
||||
current_path.should == '/admin/login'
|
||||
end
|
||||
|
||||
it 'should redirect to login path' do
|
||||
visit admin_admin_user_url(@admin_user)
|
||||
current_path.should == '/admin/login'
|
||||
end
|
||||
|
||||
it 'should redirect to login path' do
|
||||
visit edit_admin_admin_user_url(@admin_user)
|
||||
current_path.should == '/admin/login'
|
||||
end
|
||||
end
|
||||
|
||||
context 'as logged in user' do
|
||||
it 'should show index of contacts' do
|
||||
sign_in @admin_user
|
||||
visit admin_admin_users_url
|
||||
|
||||
current_path.should == '/admin/admin_users'
|
||||
page.should have_content('API users')
|
||||
end
|
||||
|
||||
it 'should show api user' do
|
||||
sign_in @admin_user
|
||||
visit admin_admin_user_url(@admin_user)
|
||||
|
||||
current_path.should == "/admin/admin_users/#{@admin_user.id}"
|
||||
end
|
||||
|
||||
it 'should show api user' do
|
||||
sign_in @admin_user
|
||||
visit edit_admin_admin_user_url(@admin_user)
|
||||
|
||||
current_path.should == "/admin/admin_users/#{@admin_user.id}/edit"
|
||||
page.should have_content("Edit: #{@admin_user.username}")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,40 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Api users', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
@api_user = Fabricate(:api_user)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
it 'should redirect to login path' do
|
||||
visit admin_api_users_url
|
||||
|
||||
current_path.should == '/admin/login'
|
||||
end
|
||||
|
||||
it 'should redirect to login path' do
|
||||
visit admin_api_user_url(@api_user)
|
||||
|
||||
current_path.should == '/admin/login'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'as logged in user' do
|
||||
it 'should show index of api users' do
|
||||
sign_in @user
|
||||
visit admin_api_users_url
|
||||
|
||||
current_path.should == '/admin/api_users'
|
||||
page.should have_content('API users')
|
||||
end
|
||||
|
||||
it 'should show api user' do
|
||||
sign_in @user
|
||||
visit admin_api_user_url(@api_user)
|
||||
|
||||
current_path.should == "/admin/api_users/#{@api_user.id}"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,52 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'BankStatement', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
end
|
||||
|
||||
before do
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
it 'should add a bank statement and transactions manually' do
|
||||
visit admin_bank_statements_url
|
||||
|
||||
click_link 'Add'
|
||||
fill_in 'Bank code', with: '767'
|
||||
fill_in 'Iban', with: 'EE557700771000598731'
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content('Record created')
|
||||
page.should have_content('Bank statement ')
|
||||
page.should have_content('767')
|
||||
page.should have_content('EE557700771000598731')
|
||||
page.should have_content('Not binded')
|
||||
|
||||
click_link 'Add'
|
||||
fill_in 'Description', with: 'Payment 12345'
|
||||
fill_in 'Sum', with: '120'
|
||||
fill_in 'Reference no', with: 'RF4663930489'
|
||||
fill_in 'Document no', with: '123'
|
||||
fill_in 'Bank reference', with: '767'
|
||||
fill_in 'Iban', with: 'EE557700771000598731'
|
||||
fill_in 'Buyer bank code', with: '767'
|
||||
fill_in 'Buyer iban', with: 'EE557700771000598000'
|
||||
fill_in 'Buyer name', with: 'Test buyer'
|
||||
fill_in 'Paid at', with: '2015-01-01'
|
||||
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content('Record created')
|
||||
page.should have_content('Bank transaction')
|
||||
page.should have_content('RF4663930489')
|
||||
page.should have_content('EE557700771000598000')
|
||||
page.should have_content('Not binded')
|
||||
page.should have_content('Bind manually')
|
||||
|
||||
click_link 'Back to bank statement'
|
||||
|
||||
page.should have_content('120,00')
|
||||
page.should have_content('Test buyer')
|
||||
end
|
||||
end
|
|
@ -1,31 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'BlockedDomain', type: :feature do
|
||||
before :all do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
@user = Fabricate(:admin_user)
|
||||
end
|
||||
|
||||
before do
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
it 'should manage blocked domains' do
|
||||
visit admin_blocked_domains_url
|
||||
page.should have_content('Blocked domains')
|
||||
|
||||
d = Fabricate.build(:domain, name: 'ftp.ee')
|
||||
d.valid?
|
||||
d.errors.full_messages.should match_array([])
|
||||
|
||||
fill_in 'blocked_domains', with: "ftp.ee\ncache.ee"
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content('Record updated')
|
||||
page.should have_content('ftp.ee')
|
||||
page.should have_content('cache.ee')
|
||||
|
||||
d.valid?
|
||||
d.errors.full_messages.should match_array(["Data management policy violation: Domain name is blocked [name]"])
|
||||
end
|
||||
end
|
|
@ -1,60 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Admin contact', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
@contact = Fabricate(:contact, name: 'Mr John')
|
||||
end
|
||||
|
||||
it 'should show index of contacts' do
|
||||
sign_in @user
|
||||
visit admin_contacts_url
|
||||
|
||||
page.should have_content('Mr John')
|
||||
end
|
||||
|
||||
it 'should show correct contact creator' do
|
||||
sign_in @user
|
||||
visit admin_contacts_url
|
||||
|
||||
click_link('Mr John')
|
||||
# initially it's created by unknown,
|
||||
# indivitually running it's created by autotest
|
||||
page.should have_content(/by [unknown|autotest]/)
|
||||
end
|
||||
|
||||
it 'should search contacts by name' do
|
||||
Fabricate(:contact, name: 'first name')
|
||||
Fabricate(:contact, name: 'second name')
|
||||
Fabricate(:contact, name: 'third name')
|
||||
sign_in @user
|
||||
visit admin_contacts_url
|
||||
|
||||
page.should have_content('first name')
|
||||
page.should have_content('second name')
|
||||
page.should have_content('third name')
|
||||
|
||||
fill_in 'q_name_matches', with: 'first name'
|
||||
find('.btn.btn-primary').click
|
||||
|
||||
current_path.should == "/admin/contacts"
|
||||
|
||||
page.should have_content('first name')
|
||||
page.should_not have_content('second name')
|
||||
page.should_not have_content('third name')
|
||||
|
||||
fill_in 'q_name_matches', with: '%name'
|
||||
find('.btn.btn-primary').click
|
||||
|
||||
page.should have_content('first name')
|
||||
page.should have_content('second name')
|
||||
page.should have_content('third name')
|
||||
|
||||
fill_in 'q_name_matches', with: 'sec___ name'
|
||||
find('.btn.btn-primary').click
|
||||
|
||||
page.should_not have_content('first name')
|
||||
page.should have_content('second name')
|
||||
page.should_not have_content('third name')
|
||||
end
|
||||
end
|
|
@ -1,89 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Domain', type: :feature do
|
||||
before :all do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zonefile_setting, origin: 'pri.ee')
|
||||
@user = Fabricate(:admin_user)
|
||||
end
|
||||
|
||||
it 'should show index of domains' do
|
||||
Fabricate(:domain, name: 'testing.ee')
|
||||
sign_in @user
|
||||
visit admin_domains_url
|
||||
|
||||
page.should have_content('testing.ee')
|
||||
end
|
||||
|
||||
it 'should search domains by name' do
|
||||
d1 = Fabricate(:domain, name: 'abcde.ee')
|
||||
Fabricate(:domain, name: 'abcdee.ee')
|
||||
Fabricate(:domain, name: 'defgh.pri.ee')
|
||||
sign_in @user
|
||||
visit admin_domains_url
|
||||
|
||||
page.should have_content('abcde.ee')
|
||||
page.should have_content('abcdee.ee')
|
||||
page.should have_content('defgh.pri.ee')
|
||||
|
||||
fill_in 'q_name_matches', with: 'abcde.ee'
|
||||
find('.btn.btn-primary').click
|
||||
|
||||
current_path.should == "/admin/domains/#{d1.id}"
|
||||
|
||||
visit admin_domains_url
|
||||
fill_in 'q_name_matches', with: '.ee'
|
||||
find('.btn.btn-primary').click
|
||||
|
||||
current_path.should == "/admin/domains"
|
||||
page.should have_content('abcde.ee')
|
||||
page.should have_content('abcdee.ee')
|
||||
page.should have_content('defgh.pri.ee')
|
||||
|
||||
fill_in 'q_name_matches', with: 'abcd%.ee'
|
||||
find('.btn.btn-primary').click
|
||||
page.should have_content('abcde.ee')
|
||||
page.should have_content('abcdee.ee')
|
||||
page.should_not have_content('defgh.pri.ee')
|
||||
|
||||
fill_in 'q_name_matches', with: 'abcd_.ee'
|
||||
find('.btn.btn-primary').click
|
||||
current_path.should == "/admin/domains/#{d1.id}"
|
||||
end
|
||||
|
||||
it 'should set domain to force delete' do
|
||||
d = Fabricate(:domain)
|
||||
sign_in @user
|
||||
visit admin_domains_url
|
||||
click_link d.name
|
||||
click_link 'Edit statuses'
|
||||
page.should have_content('ok')
|
||||
click_link 'Set force delete'
|
||||
page.should have_content('serverForceDelete')
|
||||
page.should have_content('serverRenewProhibited')
|
||||
page.should have_content('serverTransferProhibited')
|
||||
page.should have_content('serverUpdateProhibited')
|
||||
page.should have_content('serverManualInzone')
|
||||
page.should have_content('pendingDelete')
|
||||
|
||||
click_link 'Edit statuses'
|
||||
click_button 'Save'
|
||||
page.should have_content('Failed to update domain')
|
||||
page.should have_content('Object status prohibits operation')
|
||||
|
||||
click_link 'Back to domain'
|
||||
click_link 'Edit statuses'
|
||||
click_link 'Unset force delete'
|
||||
page.should_not have_content('serverForceDelete')
|
||||
page.should_not have_content('serverRenewProhibited')
|
||||
page.should_not have_content('serverTransferProhibited')
|
||||
page.should_not have_content('serverUpdateProhibited')
|
||||
page.should_not have_content('serverManualInzone')
|
||||
page.should_not have_content('pendingDelete')
|
||||
page.should have_content('ok')
|
||||
|
||||
click_link 'Edit statuses'
|
||||
click_button 'Save'
|
||||
page.should have_content('Domain updated!')
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'EPP log', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
@contact = Fabricate(:contact, name: 'Mr John')
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
it 'should redirect to login path' do
|
||||
visit admin_epp_logs_url
|
||||
|
||||
current_path.should == '/admin/login'
|
||||
end
|
||||
end
|
||||
|
||||
context 'as logged in user' do
|
||||
it 'should show index' do
|
||||
sign_in @user
|
||||
visit admin_epp_logs_url
|
||||
|
||||
page.should have_content('REPP logs')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,131 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Invoice', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
@invoice = Fabricate(:invoice)
|
||||
end
|
||||
|
||||
before do
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
it 'should show index of invoices' do
|
||||
visit admin_invoices_url
|
||||
page.should have_link("Invoice no. #{@invoice.id}")
|
||||
end
|
||||
|
||||
it 'should show invoice' do
|
||||
visit admin_invoices_url
|
||||
|
||||
click_link("Invoice no. #{@invoice.id}")
|
||||
page.should have_content("Seller")
|
||||
page.should have_content("Details")
|
||||
page.should have_content("Paldiski mnt. 123")
|
||||
end
|
||||
|
||||
it 'should issue an invoice' do
|
||||
Fabricate(:eis)
|
||||
r = Fabricate(:registrar)
|
||||
visit admin_invoices_url
|
||||
click_link('Add')
|
||||
page.should have_content('Create new invoice')
|
||||
select r.name, from: 'Registrar'
|
||||
fill_in 'Amount', with: '100'
|
||||
fill_in 'Description', with: 'test issue'
|
||||
click_button 'Save'
|
||||
page.should have_content('Record created')
|
||||
page.should have_content('Invoice no.')
|
||||
page.should have_content('Prepayment')
|
||||
page.should have_content('120,00')
|
||||
page.should have_content(r.name)
|
||||
end
|
||||
|
||||
it 'should not issue and invoice with deposit amount too small' do
|
||||
Setting.minimum_deposit = 0.0
|
||||
r = Fabricate(:registrar)
|
||||
visit admin_invoices_url
|
||||
click_link('Add')
|
||||
select r.name, from: 'Registrar'
|
||||
fill_in 'Amount', with: '-2.11'
|
||||
fill_in 'Description', with: 'test issue'
|
||||
click_button 'Save'
|
||||
page.should have_content('Amount is too small. Minimum deposit is 0.0 EUR')
|
||||
Setting.minimum_deposit = 12.43
|
||||
fill_in 'Amount', with: '12.42'
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content('Amount is too small. Minimum deposit is 12.43 EUR')
|
||||
fill_in 'Amount', with: '12.44'
|
||||
click_button 'Save'
|
||||
page.should have_content('Record created')
|
||||
Setting.minimum_deposit = 0.0
|
||||
end
|
||||
|
||||
it 'should forward invoice' do
|
||||
visit '/admin/invoices'
|
||||
click_link @invoice.to_s
|
||||
click_link 'Forward'
|
||||
click_button 'Forward'
|
||||
page.should have_text('Failed to forward invoice')
|
||||
fill_in 'Billing email', with: 'test@test.ee'
|
||||
click_button 'Forward'
|
||||
page.should have_text('Invoice forwarded')
|
||||
end
|
||||
|
||||
it 'should download invoice' do
|
||||
visit '/admin/invoices'
|
||||
click_link @invoice.to_s
|
||||
click_link 'Download'
|
||||
response_headers['Content-Type'].should == 'application/pdf'
|
||||
response_headers['Content-Disposition'].should == "attachment; filename=\"#{@invoice.pdf_name}\""
|
||||
end
|
||||
|
||||
it 'should create bank statement and transaction for invoice' do
|
||||
r = Fabricate(:registrar, reference_no: 'RF7086666663')
|
||||
invoice = r.issue_prepayment_invoice(200, 'add some money')
|
||||
|
||||
visit '/admin/invoices'
|
||||
click_link invoice.to_s
|
||||
|
||||
page.should have_content('Unpaid')
|
||||
|
||||
click_link 'Payment received'
|
||||
|
||||
paid_at = Time.zone.now
|
||||
find_field('Bank code').value.should == '689'
|
||||
find_field('Iban').value.should == 'EE557700771000598731'
|
||||
find_field('Description').value.should == invoice.to_s
|
||||
find_field('Sum').value.should == invoice.sum.to_s
|
||||
find_field('Currency').value.should == 'EUR'
|
||||
find_field('Reference no').value.should == invoice.reference_no
|
||||
find_field('Paid at').value.should == paid_at.to_date.to_s
|
||||
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content('Record created')
|
||||
page.should have_content('689')
|
||||
page.should have_content('EE557700771000598731')
|
||||
page.should have_content('Not binded', count: 2)
|
||||
page.should have_content('240,00')
|
||||
page.should have_content('EUR')
|
||||
|
||||
click_link 'Bind invoices'
|
||||
|
||||
page.should have_content('Invoices were fully binded')
|
||||
page.should have_content('Fully binded')
|
||||
page.should have_content('Binded')
|
||||
|
||||
click_link I18n.l(paid_at, format: :date_long)
|
||||
|
||||
page.should have_content('Binded')
|
||||
page.should have_content(invoice.to_s)
|
||||
page.should have_content('240,00')
|
||||
page.should have_content(invoice.reference_no)
|
||||
page.should have_content(I18n.l(paid_at, format: :date_long))
|
||||
|
||||
click_link(invoice.to_s)
|
||||
page.should_not have_content('Unpaid')
|
||||
page.should_not have_content('Payment received')
|
||||
end
|
||||
end
|
|
@ -1,47 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'MailTemplate', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
end
|
||||
|
||||
before do
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
it 'should add a bank statement and transactions manually' do
|
||||
visit admin_mail_templates_url
|
||||
|
||||
click_link 'New'
|
||||
fill_in 'Name', with: 'Testing email template'
|
||||
fill_in 'Subject', with: 'Test subject'
|
||||
fill_in 'From', with: 'example@example.com'
|
||||
fill_in 'mail_template_body', with: 'Liquid <h1>Test</h1>'
|
||||
fill_in 'mail_template_text_body', with: 'Liquid static test'
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content('Testing email template')
|
||||
page.should have_content('Test subject')
|
||||
page.should have_content('example@example.com')
|
||||
page.should have_content('Liquid Test')
|
||||
page.should have_content('Liquid static test')
|
||||
|
||||
click_link 'Email Templates'
|
||||
page.should have_content('Mail Templates')
|
||||
page.should have_content('Test subject')
|
||||
|
||||
click_link 'Testing email template'
|
||||
page.should have_content('Testing email template')
|
||||
|
||||
click_link 'Edit'
|
||||
page.should have_content('Edit: Testing email template')
|
||||
fill_in 'Subject', with: 'New edited test subject'
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content 'New edited test subject'
|
||||
click_link 'Delete'
|
||||
|
||||
page.should have_content 'Mail Templates'
|
||||
page.should_not have_content 'New edited test subject'
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Repp log', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
it 'should redirect to login path' do
|
||||
visit admin_repp_logs_url
|
||||
|
||||
current_path.should == '/admin/login'
|
||||
end
|
||||
end
|
||||
|
||||
context 'as logged in user' do
|
||||
it 'should show index' do
|
||||
sign_in @user
|
||||
visit admin_repp_logs_url
|
||||
|
||||
page.should have_content('REPP logs')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,44 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'ReservedDomain', type: :feature do
|
||||
before :all do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
@user = Fabricate(:admin_user)
|
||||
end
|
||||
|
||||
before do
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
it 'should manage reserved domains' do
|
||||
visit admin_reserved_domains_url
|
||||
page.should have_content('Reserved domains')
|
||||
|
||||
d = Fabricate.build(:domain, name: '110.ee')
|
||||
d.valid?
|
||||
d.errors.full_messages.should match_array([])
|
||||
|
||||
fill_in 'reserved_domains', with: "110.ee: testpw"
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content('Record updated')
|
||||
page.should have_content('110.ee: testpw')
|
||||
|
||||
d.valid?.should == false
|
||||
d.errors.full_messages.should match_array(
|
||||
["Required parameter missing; reserved>pw element required for reserved domains"]
|
||||
)
|
||||
|
||||
d.reserved_pw = 'wrongpw'
|
||||
d.valid?.should == false
|
||||
|
||||
d.reserved_pw = 'testpw'
|
||||
d.valid?.should == true
|
||||
d.errors.full_messages.should match_array([])
|
||||
|
||||
d.save
|
||||
visit admin_reserved_domains_url
|
||||
page.should have_content('110.ee')
|
||||
page.should_not have_content('110.ee: testpw')
|
||||
end
|
||||
end
|
|
@ -1,63 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Api users', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
@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'
|
||||
find('#white_ip_interfaces_api').set(true)
|
||||
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('API')
|
||||
|
||||
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('API')
|
||||
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
|
|
@ -1,99 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Zonefile settings', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
it 'should redirect to login path' do
|
||||
visit admin_zonefile_settings_url
|
||||
|
||||
current_path.should == '/admin/login'
|
||||
end
|
||||
end
|
||||
|
||||
context 'as logged in user' do
|
||||
it 'should show index of contacts' do
|
||||
sign_in @user
|
||||
visit admin_zonefile_settings_url
|
||||
|
||||
page.should have_content('Zonefile settings')
|
||||
end
|
||||
|
||||
it 'should create zone' do
|
||||
sign_in @user
|
||||
visit admin_zonefile_settings_url
|
||||
|
||||
page.should_not have_content('Generate zonefile')
|
||||
|
||||
click_link 'New'
|
||||
fill_in 'Origin', with: 'ee'
|
||||
fill_in 'TTL', with: '43200'
|
||||
fill_in 'Refresh', with: '3600'
|
||||
fill_in 'Retry', with: '900'
|
||||
fill_in 'Expire', with: '1209600'
|
||||
fill_in 'Minimum TTL', with: '3600'
|
||||
fill_in 'E-Mail', with: 'hostmaster.eestiinternet.ee'
|
||||
fill_in 'Master nameserver', with: 'ns.tld.ee'
|
||||
fill_in('Ns records', with: '
|
||||
ee. IN NS sunic.sunet.se.
|
||||
ee. IN NS ns.eenet.ee.
|
||||
ee. IN NS ns.tld.ee.
|
||||
ee. IN NS ns.ut.ee.
|
||||
ee. IN NS e.tld.ee.
|
||||
ee. IN NS b.tld.ee.
|
||||
ee. IN NS ee.aso.ee.
|
||||
')
|
||||
|
||||
fill_in('A records', with: '
|
||||
ns.ut.ee. IN A 193.40.5.99
|
||||
ns.tld.ee. IN A 195.43.87.10
|
||||
ee.aso.ee. IN A 213.184.51.122
|
||||
b.tld.ee. IN A 194.146.106.110
|
||||
ns.eenet.ee. IN A 193.40.56.245
|
||||
e.tld.ee. IN A 204.61.216.36
|
||||
')
|
||||
|
||||
fill_in('AAAA records', with: '
|
||||
ee.aso.ee. IN AAAA 2A02:88:0:21::2
|
||||
b.tld.ee. IN AAAA 2001:67C:1010:28::53
|
||||
ns.eenet.ee. IN AAAA 2001:BB8::1
|
||||
e.tld.ee. IN AAAA 2001:678:94:53::53
|
||||
')
|
||||
|
||||
click_button 'Save'
|
||||
|
||||
page.should have_content('Record created')
|
||||
page.should have_content('ee')
|
||||
page.should have_content('Generate zonefile')
|
||||
|
||||
click_link 'Generate zonefile'
|
||||
response_headers['Content-Type'].should == 'text/plain'
|
||||
response_headers['Content-Disposition'].should == "attachment; filename=\"ee.txt\""
|
||||
end
|
||||
|
||||
it 'does not delete zone with existin domains' do
|
||||
ZonefileSetting.find_by(origin: 'ee') || Fabricate(:zonefile_setting)
|
||||
Fabricate(:domain)
|
||||
sign_in @user
|
||||
visit admin_zonefile_settings_url
|
||||
click_link 'ee'
|
||||
click_link 'Delete'
|
||||
|
||||
page.should have_content("There are 1 domains in this zone")
|
||||
page.should have_content('Failed to delete record')
|
||||
end
|
||||
|
||||
it 'deletes a zone' do
|
||||
ZonefileSetting.find_by(origin: 'ee') || Fabricate(:zonefile_setting)
|
||||
Domain.destroy_all
|
||||
sign_in @user
|
||||
visit admin_zonefile_settings_url
|
||||
click_link 'ee'
|
||||
click_link 'Delete'
|
||||
page.should have_content('Record deleted')
|
||||
page.should_not have_content("Generate zonefile")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue