mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
refactored: extra line breaks, extra indentation, extra comments
This commit is contained in:
parent
ed3ee5ffc0
commit
02b5c8c4b6
17 changed files with 310 additions and 346 deletions
|
@ -13,7 +13,6 @@ class ApplicationSystemTestCase < ActionDispatch::IntegrationTest
|
|||
WebMock.reset!
|
||||
Capybara.reset_sessions!
|
||||
Capybara.use_default_driver
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,21 +28,16 @@ class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase
|
|||
options.add_argument('--disable-dev-shm-usage')
|
||||
options.add_argument('--window-size=1400,1400')
|
||||
|
||||
|
||||
|
||||
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
||||
|
||||
end
|
||||
|
||||
Capybara.server = :puma, { Silent: true }
|
||||
|
||||
def setup
|
||||
DatabaseCleaner.start
|
||||
|
||||
super
|
||||
|
||||
Capybara.current_driver = :chrome
|
||||
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
|
|
@ -30,7 +30,6 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
|
||||
select 'Estonia', from: 'admin_user_country_code', match: :first
|
||||
|
||||
# '//div[@class="selectize-input items has-options full has-items"]'
|
||||
select_element = find(:xpath, "/html/body/div[2]/form/div[2]/div/div[7]/div[2]/div/div[1]")
|
||||
select_element.click
|
||||
|
||||
|
@ -39,7 +38,6 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
|
||||
click_on 'Save'
|
||||
|
||||
# if user created with valid data then record successfuly, else it failed
|
||||
if valid
|
||||
assert_text 'Record created'
|
||||
else
|
||||
|
|
|
@ -11,25 +11,6 @@ class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCa
|
|||
@blocked_domain = blocked_domains(:one)
|
||||
end
|
||||
|
||||
# HELPERS
|
||||
def visit_admin_blocked_domains_path
|
||||
visit admin_blocked_domains_path
|
||||
assert_text 'Blocked domains'
|
||||
end
|
||||
|
||||
def add_domain_into_blocked_list(value)
|
||||
click_on 'New blocked domain'
|
||||
assert_text 'Add domain to blocked list'
|
||||
|
||||
fill_in 'Name', with: @domain.name
|
||||
click_on 'Save'
|
||||
|
||||
return assert_text 'Domain added!' if value
|
||||
return assert_text 'Failed to add domain!'
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# TESTs
|
||||
def test_page_successfully_loaded
|
||||
visit_admin_blocked_domains_path
|
||||
end
|
||||
|
@ -67,4 +48,21 @@ class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCa
|
|||
assert_text @domain.name
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def visit_admin_blocked_domains_path
|
||||
visit admin_blocked_domains_path
|
||||
assert_text 'Blocked domains'
|
||||
end
|
||||
|
||||
def add_domain_into_blocked_list(value)
|
||||
click_on 'New blocked domain'
|
||||
assert_text 'Add domain to blocked list'
|
||||
|
||||
fill_in 'Name', with: @domain.name
|
||||
click_on 'Save'
|
||||
|
||||
return assert_text 'Domain added!' if value
|
||||
return assert_text 'Failed to add domain!'
|
||||
end
|
||||
end
|
|
@ -12,13 +12,6 @@ class AdminAreaCertificatesIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
@certificate.update!(csr: "-----BEGIN CERTIFICATE REQUEST-----\nMIICszCCAZsCAQAwbjELMAkGA1UEBhMCRUUxFDASBgNVBAMMC2ZyZXNoYm94LmVl\nMRAwDgYDVQQHDAdUYWxsaW5uMREwDwYDVQQKDAhGcmVzaGJveDERMA8GA1UECAwI\nSGFyanVtYWExETAPBgNVBAsMCEZyZXNoYm94MIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEA1VVESynZoZhIbe8s9zHkELZ/ZDCGiM2Q8IIGb1IOieT5U2mx\nIsVXz85USYsSQY9+4YdEXnupq9fShArT8pstS/VN6BnxdfAiYXc3UWWAuaYAdNGJ\nDr5Jf6uMt1wVnCgoDL7eJq9tWMwARC/viT81o92fgqHFHW0wEolfCmnpik9o0ACD\nFiWZ9IBIevmFqXtq25v9CY2cT9+eZW127WtJmOY/PKJhzh0QaEYHqXTHWOLZWpnp\nHH4elyJ2CrFulOZbHPkPNB9Nf4XQjzk1ffoH6e5IVys2VV5xwcTkF0jY5XTROVxX\nlR2FWqic8Q2pIhSks48+J6o1GtXGnTxv94lSDwIDAQABoAAwDQYJKoZIhvcNAQEL\nBQADggEBAEFcYmQvcAC8773eRTWBJJNoA4kRgoXDMYiiEHih5iJPVSxfidRwYDTF\nsP+ttNTUg3JocFHY75kuM9T2USh+gu/trRF0o4WWa+AbK3JbbdjdT1xOMn7XtfUU\nZ/f1XCS9YdHQFCA6nk4Z+TLWwYsgk7n490AQOiB213fa1UIe83qIfw/3GRqRUZ7U\nwIWEGsHED5WT69GyxjyKHcqGoV7uFnqFN0sQVKVTy/NFRVQvtBUspCbsOirdDRie\nAB2KbGHL+t1QrRF10szwCJDyk5aYlVhxvdI8zn010nrxHkiyQpDFFldDMLJl10BW\n2w9PGO061z+tntdRcKQGuEpnIr9U5Vs=\n-----END CERTIFICATE REQUEST-----\n")
|
||||
end
|
||||
|
||||
# Helpers =======================
|
||||
def show_certificate_info
|
||||
visit admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||
assert_text 'Certificates'
|
||||
end
|
||||
|
||||
# TESTs ===========================
|
||||
def test_show_certificate_info
|
||||
show_certificate_info
|
||||
end
|
||||
|
@ -69,4 +62,10 @@ class AdminAreaCertificatesIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
assert_text 'API user has been successfully created'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def show_certificate_info
|
||||
visit admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||
assert_text 'Certificates'
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
require 'test_helper'
|
||||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaDelayedJobsIntegrationTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
# TODO
|
||||
end
|
|
@ -7,18 +7,6 @@ class AdminEppLogsIntegrationTest < ApplicationSystemTestCase
|
|||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def send_epp_request_hello
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<hello/>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
get epp_hello_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||
end
|
||||
|
||||
def test_visit_epp_logs_page
|
||||
visit admin_epp_logs_path
|
||||
assert_text 'EPP log'
|
||||
|
@ -48,4 +36,17 @@ class AdminEppLogsIntegrationTest < ApplicationSystemTestCase
|
|||
assert_match /#{date_now}/, epp_log_date
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def send_epp_request_hello
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<hello/>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
get epp_hello_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||
end
|
||||
end
|
|
@ -11,13 +11,9 @@ class AdminAreaInvoicesIntegrationTest < ApplicationIntegrationTest
|
|||
|
||||
assert_text 'Create new invoice'
|
||||
select 'Best Names', from: 'deposit_registrar_id', match: :first
|
||||
|
||||
fill_in 'Amount', with: '1000'
|
||||
|
||||
click_on 'Save'
|
||||
|
||||
# TODO
|
||||
# Should be assert_text 'Record created'
|
||||
assert_equal page.status_code, 200
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ require 'test_helper'
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaPendingDeleteIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
|
|
|
@ -2,7 +2,6 @@ require 'test_helper'
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaReppLogsIntegrationTest < ApplicationSystemTestCase
|
||||
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
@ -12,7 +11,6 @@ class AdminAreaReppLogsIntegrationTest < ApplicationSystemTestCase
|
|||
assert_text 'REPP log'
|
||||
end
|
||||
|
||||
|
||||
def test_show_repp_log_page
|
||||
visit admin_repp_logs_path
|
||||
get repp_v1_contacts_path
|
||||
|
@ -22,5 +20,4 @@ class AdminAreaReppLogsIntegrationTest < ApplicationSystemTestCase
|
|||
|
||||
assert_text 'REPP log'
|
||||
end
|
||||
|
||||
end
|
|
@ -45,5 +45,4 @@ class AdminAreaReservedDomainsIntegrationTest < JavaScriptApplicationSystemTestC
|
|||
|
||||
assert_text 'Domain updated!'
|
||||
end
|
||||
|
||||
end
|
|
@ -11,24 +11,6 @@ class AdminAreaWhiteIpsIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
@white_ip = white_ips(:one)
|
||||
end
|
||||
|
||||
# Helpers ====================================
|
||||
def visit_new_whitelisted_ip_page
|
||||
visit new_admin_registrar_white_ip_path(registrar_id: @registrar.id)
|
||||
assert_text 'New whitelisted IP'
|
||||
end
|
||||
|
||||
def visit_edit_whitelisted_ip_page
|
||||
visit edit_admin_registrar_white_ip_path(registrar_id: @registrar.id, id: @white_ip.id)
|
||||
assert_text 'Edit white IP'
|
||||
end
|
||||
|
||||
def visit_info_whitelisted_ip_page
|
||||
visit admin_registrar_white_ip_path(registrar_id: @registrar.id, id: @white_ip.id)
|
||||
assert_text 'White IP'
|
||||
end
|
||||
|
||||
# Tests =====================================
|
||||
|
||||
def test_visit_new_whitelisted_ip_page
|
||||
visit_new_whitelisted_ip_page
|
||||
end
|
||||
|
@ -64,9 +46,7 @@ class AdminAreaWhiteIpsIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
click_on 'Edit'
|
||||
|
||||
fill_in 'IPv4', with: "127.0.0.2"
|
||||
|
||||
find(:css, "#white_ip_interfaces_api").set(false)
|
||||
|
||||
click_on 'Save'
|
||||
|
||||
assert_text 'Record updated'
|
||||
|
@ -75,7 +55,6 @@ class AdminAreaWhiteIpsIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
def test_failed_to_update_whitelisted_ip
|
||||
visit_info_whitelisted_ip_page
|
||||
click_on 'Edit'
|
||||
|
||||
fill_in 'IPv4', with: "asdadad#"
|
||||
|
||||
click_on 'Save'
|
||||
|
@ -89,11 +68,27 @@ class AdminAreaWhiteIpsIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
|
||||
def test_delete_whitelisted_ip
|
||||
visit_info_whitelisted_ip_page
|
||||
|
||||
click_on 'Delete'
|
||||
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
assert_text 'Record deleted'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def visit_new_whitelisted_ip_page
|
||||
visit new_admin_registrar_white_ip_path(registrar_id: @registrar.id)
|
||||
assert_text 'New whitelisted IP'
|
||||
end
|
||||
|
||||
def visit_edit_whitelisted_ip_page
|
||||
visit edit_admin_registrar_white_ip_path(registrar_id: @registrar.id, id: @white_ip.id)
|
||||
assert_text 'Edit white IP'
|
||||
end
|
||||
|
||||
def visit_info_whitelisted_ip_page
|
||||
visit admin_registrar_white_ip_path(registrar_id: @registrar.id, id: @white_ip.id)
|
||||
assert_text 'White IP'
|
||||
end
|
||||
end
|
|
@ -8,8 +8,6 @@ class AdminContactsTest < ApplicationSystemTestCase
|
|||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
|
||||
# admin_contact
|
||||
def test_update_contact
|
||||
visit admin_contact_path(id: @contact.id)
|
||||
assert_text "#{@contact.name}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue