mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Remove specs
This commit is contained in:
parent
68750883f0
commit
54577b530b
127 changed files with 1954 additions and 7197 deletions
47
test/system/admin_area/prices_test.rb
Normal file
47
test/system/admin_area/prices_test.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaPricesTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
@price = billing_prices(:create_one_month)
|
||||
end
|
||||
|
||||
def test_adds_new_price_with_required_attributes
|
||||
effective_date = Date.parse('2010-07-06')
|
||||
assert_nil Billing::Price.find_by(valid_from: effective_date)
|
||||
|
||||
visit admin_prices_url
|
||||
click_on 'New price'
|
||||
|
||||
select dns_zones(:one).origin, from: 'Zone'
|
||||
select Billing::Price.operation_categories.first, from: 'Operation category'
|
||||
select '3 months', from: 'Duration'
|
||||
fill_in 'Price', with: '1'
|
||||
fill_in 'Valid from', with: effective_date
|
||||
click_on 'Create price'
|
||||
|
||||
assert_text 'Price has been created'
|
||||
assert_text I18n.localize(effective_date)
|
||||
end
|
||||
|
||||
def test_changes_price
|
||||
new_effective_date = Date.parse('2010-07-06')
|
||||
assert_not_equal new_effective_date, @price.valid_from
|
||||
|
||||
visit admin_prices_url
|
||||
find('.edit-price-btn').click
|
||||
fill_in 'Valid from', with: new_effective_date
|
||||
click_on 'Update price'
|
||||
|
||||
assert_text 'Price has been updated'
|
||||
assert_text I18n.localize(new_effective_date)
|
||||
end
|
||||
|
||||
def test_expires_price
|
||||
visit admin_prices_url
|
||||
find('.edit-price-btn').click
|
||||
click_on 'Expire'
|
||||
|
||||
assert_text 'Price has been expired'
|
||||
end
|
||||
end
|
13
test/system/admin_area/settings_test.rb
Normal file
13
test/system/admin_area/settings_test.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaSettingsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def test_saves_settings
|
||||
visit admin_settings_url
|
||||
click_link_or_button 'Save'
|
||||
assert_text 'Settings have been successfully updated'
|
||||
end
|
||||
end
|
46
test/system/admin_area/zones_test.rb
Normal file
46
test/system/admin_area/zones_test.rb
Normal file
|
@ -0,0 +1,46 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaZonesTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
@zone = dns_zones(:one)
|
||||
end
|
||||
|
||||
def test_creates_new_zone_with_required_attributes
|
||||
origin = 'com.test'
|
||||
assert_nil DNS::Zone.find_by(origin: origin)
|
||||
|
||||
visit admin_zones_url
|
||||
click_on 'New zone'
|
||||
|
||||
fill_in 'Origin', with: origin
|
||||
fill_in 'Ttl', with: '1'
|
||||
fill_in 'Refresh', with: '1'
|
||||
fill_in 'Retry', with: '1'
|
||||
fill_in 'Expire', with: '1'
|
||||
fill_in 'Minimum ttl', with: '1'
|
||||
fill_in 'Email', with: 'new.registry.test'
|
||||
fill_in 'Master nameserver', with: 'any.test'
|
||||
click_on 'Create zone'
|
||||
|
||||
assert_text 'Zone has been created'
|
||||
assert_text origin
|
||||
end
|
||||
|
||||
def test_changes_zone
|
||||
new_email = 'new@registry.test'
|
||||
assert_not_equal new_email, @zone.email
|
||||
|
||||
visit admin_zones_url
|
||||
click_on 'admin-edit-zone-btn'
|
||||
fill_in 'Email', with: new_email
|
||||
click_on 'Update zone'
|
||||
|
||||
assert_text 'Zone has been updated'
|
||||
end
|
||||
|
||||
def test_origin_is_not_editable
|
||||
visit edit_admin_zone_url(@zone)
|
||||
assert_no_field 'Origin'
|
||||
end
|
||||
end
|
33
test/system/registrar_area/base_test.rb
Normal file
33
test/system/registrar_area/base_test.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class RegistrarAreaBaseTestTest < ApplicationSystemTestCase
|
||||
def test_user_cannot_access_without_ip_address_being_whitelisted
|
||||
Setting.registrar_ip_whitelist_enabled = true
|
||||
WhiteIp.delete_all
|
||||
|
||||
visit new_registrar_user_session_url
|
||||
|
||||
assert_text 'Access denied from IP 127.0.0.1'
|
||||
assert_no_button 'Login'
|
||||
end
|
||||
|
||||
def test_user_can_access_when_ip_is_whitelisted
|
||||
white_ips(:one).update!(ipv4: '127.0.0.1', interfaces: [WhiteIp::REGISTRAR])
|
||||
Setting.registrar_ip_whitelist_enabled = true
|
||||
|
||||
visit new_registrar_user_session_url
|
||||
|
||||
assert_no_text 'Access denied from IP 127.0.0.1'
|
||||
assert_button 'Login'
|
||||
end
|
||||
|
||||
def test_user_can_access_when_ip_is_not_whitelisted_and_whitelist_is_disabled
|
||||
Setting.registrar_ip_whitelist_enabled = false
|
||||
WhiteIp.delete_all
|
||||
|
||||
visit new_registrar_user_session_url
|
||||
|
||||
assert_no_text 'Access denied from IP 127.0.0.1'
|
||||
assert_button 'Login'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue