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!
|
WebMock.reset!
|
||||||
Capybara.reset_sessions!
|
Capybara.reset_sessions!
|
||||||
Capybara.use_default_driver
|
Capybara.use_default_driver
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,21 +28,16 @@ class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase
|
||||||
options.add_argument('--disable-dev-shm-usage')
|
options.add_argument('--disable-dev-shm-usage')
|
||||||
options.add_argument('--window-size=1400,1400')
|
options.add_argument('--window-size=1400,1400')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Capybara.server = :puma, { Silent: true }
|
Capybara.server = :puma, { Silent: true }
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
DatabaseCleaner.start
|
DatabaseCleaner.start
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
||||||
Capybara.current_driver = :chrome
|
Capybara.current_driver = :chrome
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
|
|
@ -36,4 +36,4 @@ class AdminAreaAccountActivitiesIntegrationTest < ApplicationSystemTestCase
|
||||||
response.headers['Content-Disposition']
|
response.headers['Content-Disposition']
|
||||||
assert_not_empty response.body
|
assert_not_empty response.body
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,6 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
|
||||||
select 'Estonia', from: 'admin_user_country_code', match: :first
|
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 = find(:xpath, "/html/body/div[2]/form/div[2]/div/div[7]/div[2]/div/div[1]")
|
||||||
select_element.click
|
select_element.click
|
||||||
|
|
||||||
|
@ -39,7 +38,6 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
|
||||||
click_on 'Save'
|
click_on 'Save'
|
||||||
|
|
||||||
# if user created with valid data then record successfuly, else it failed
|
|
||||||
if valid
|
if valid
|
||||||
assert_text 'Record created'
|
assert_text 'Record created'
|
||||||
else
|
else
|
||||||
|
@ -103,4 +101,4 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
|
||||||
assert_text 'Record deleted'
|
assert_text 'Record deleted'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,25 +11,6 @@ class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCa
|
||||||
@blocked_domain = blocked_domains(:one)
|
@blocked_domain = blocked_domains(:one)
|
||||||
end
|
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
|
def test_page_successfully_loaded
|
||||||
visit_admin_blocked_domains_path
|
visit_admin_blocked_domains_path
|
||||||
end
|
end
|
||||||
|
@ -67,4 +48,21 @@ class AdminAreaBlockedDomainsIntegrationTest < JavaScriptApplicationSystemTestCa
|
||||||
assert_text @domain.name
|
assert_text @domain.name
|
||||||
end
|
end
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -3,70 +3,69 @@ require 'application_system_test_case'
|
||||||
|
|
||||||
class AdminAreaCertificatesIntegrationTest < JavaScriptApplicationSystemTestCase
|
class AdminAreaCertificatesIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
WebMock.allow_net_connect!
|
WebMock.allow_net_connect!
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
|
|
||||||
@apiuser = users(:api_bestnames)
|
@apiuser = users(:api_bestnames)
|
||||||
@certificate = certificates(:api)
|
@certificate = certificates(:api)
|
||||||
@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")
|
@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
|
end
|
||||||
|
|
||||||
# Helpers =======================
|
def test_show_certificate_info
|
||||||
def show_certificate_info
|
show_certificate_info
|
||||||
visit admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
end
|
||||||
assert_text 'Certificates'
|
|
||||||
end
|
|
||||||
|
|
||||||
# TESTs ===========================
|
def test_destroy_certificate
|
||||||
def test_show_certificate_info
|
show_certificate_info
|
||||||
show_certificate_info
|
find(:xpath, "//a[text()='Delete']").click
|
||||||
end
|
|
||||||
|
|
||||||
def test_destroy_certificate
|
page.driver.browser.switch_to.alert.accept
|
||||||
show_certificate_info
|
|
||||||
find(:xpath, "//a[text()='Delete']").click
|
|
||||||
|
|
||||||
page.driver.browser.switch_to.alert.accept
|
assert_text 'Record deleted'
|
||||||
|
end
|
||||||
|
|
||||||
assert_text 'Record deleted'
|
def test_download_csr
|
||||||
end
|
get download_csr_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||||
|
|
||||||
def test_download_csr
|
assert_response :ok
|
||||||
get download_csr_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
assert_equal 'application/octet-stream', response.headers['Content-Type']
|
||||||
|
assert_equal "attachment; filename=\"test_bestnames.csr.pem\"; filename*=UTF-8''test_bestnames.csr.pem", response.headers['Content-Disposition']
|
||||||
assert_response :ok
|
assert_not_empty response.body
|
||||||
assert_equal 'application/octet-stream', response.headers['Content-Type']
|
end
|
||||||
assert_equal "attachment; filename=\"test_bestnames.csr.pem\"; filename*=UTF-8''test_bestnames.csr.pem", response.headers['Content-Disposition']
|
|
||||||
assert_not_empty response.body
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_download_crt
|
def test_download_crt
|
||||||
get download_crt_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
get download_crt_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||||
|
|
||||||
assert_response :ok
|
|
||||||
assert_equal 'application/octet-stream', response.headers['Content-Type']
|
|
||||||
assert_equal "attachment; filename=\"test_bestnames.crt.pem\"; filename*=UTF-8''test_bestnames.crt.pem", response.headers['Content-Disposition']
|
|
||||||
assert_not_empty response.body
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_failed_to_revoke_certificate
|
assert_response :ok
|
||||||
show_certificate_info
|
assert_equal 'application/octet-stream', response.headers['Content-Type']
|
||||||
|
assert_equal "attachment; filename=\"test_bestnames.crt.pem\"; filename*=UTF-8''test_bestnames.crt.pem", response.headers['Content-Disposition']
|
||||||
|
assert_not_empty response.body
|
||||||
|
end
|
||||||
|
|
||||||
find(:xpath, "//a[text()='Revoke this certificate']").click
|
def test_failed_to_revoke_certificate
|
||||||
assert_text 'Failed to update record'
|
show_certificate_info
|
||||||
end
|
|
||||||
|
|
||||||
def test_new_api_user
|
find(:xpath, "//a[text()='Revoke this certificate']").click
|
||||||
visit new_admin_registrar_api_user_path(registrar_id: registrars(:bestnames).id)
|
assert_text 'Failed to update record'
|
||||||
|
end
|
||||||
|
|
||||||
fill_in 'Username', with: 'testapiuser'
|
def test_new_api_user
|
||||||
fill_in 'Password', with: 'secretpassword'
|
visit new_admin_registrar_api_user_path(registrar_id: registrars(:bestnames).id)
|
||||||
fill_in 'Identity code', with: '60305062718'
|
|
||||||
|
|
||||||
click_on 'Create API user'
|
fill_in 'Username', with: 'testapiuser'
|
||||||
|
fill_in 'Password', with: 'secretpassword'
|
||||||
|
fill_in 'Identity code', with: '60305062718'
|
||||||
|
|
||||||
assert_text 'API user has been successfully created'
|
click_on 'Create API user'
|
||||||
end
|
|
||||||
|
|
||||||
end
|
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
|
|
|
@ -3,49 +3,50 @@ require 'test_helper'
|
||||||
require 'application_system_test_case'
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class AdminEppLogsIntegrationTest < ApplicationSystemTestCase
|
class AdminEppLogsIntegrationTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_epp_request_hello
|
def test_visit_epp_logs_page
|
||||||
request_xml = <<-XML
|
visit admin_epp_logs_path
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
assert_text 'EPP log'
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
end
|
||||||
<hello/>
|
|
||||||
</epp>
|
def test_show_epp_log_page
|
||||||
|
visit admin_epp_logs_path
|
||||||
|
send_epp_request_hello
|
||||||
|
visit admin_epp_logs_path
|
||||||
|
|
||||||
|
find(:xpath, "//tbody/tr/td/a", match: :first).click
|
||||||
|
assert_text 'Details'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_dates_sort
|
||||||
|
Capybara.exact = true
|
||||||
|
visit admin_epp_logs_path
|
||||||
|
send_epp_request_hello
|
||||||
|
visit admin_epp_logs_path
|
||||||
|
|
||||||
|
find(:xpath, "//a[contains(text(), 'Created at')]", match: :first).click
|
||||||
|
find(:xpath, "//a[contains(text(), 'Created at')]", match: :first).click
|
||||||
|
|
||||||
|
epp_log_date = find(:xpath, "//table/tbody/tr/td[6]", match: :first).text(:all)
|
||||||
|
date_now = Date.today.to_s(:db)
|
||||||
|
|
||||||
|
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
|
XML
|
||||||
|
|
||||||
get epp_hello_path, params: { frame: request_xml },
|
|
||||||
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_visit_epp_logs_page
|
get epp_hello_path, params: { frame: request_xml },
|
||||||
visit admin_epp_logs_path
|
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||||
assert_text 'EPP log'
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_epp_log_page
|
|
||||||
visit admin_epp_logs_path
|
|
||||||
send_epp_request_hello
|
|
||||||
visit admin_epp_logs_path
|
|
||||||
|
|
||||||
find(:xpath, "//tbody/tr/td/a", match: :first).click
|
|
||||||
assert_text 'Details'
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_dates_sort
|
|
||||||
Capybara.exact = true
|
|
||||||
visit admin_epp_logs_path
|
|
||||||
send_epp_request_hello
|
|
||||||
visit admin_epp_logs_path
|
|
||||||
|
|
||||||
find(:xpath, "//a[contains(text(), 'Created at')]", match: :first).click
|
|
||||||
find(:xpath, "//a[contains(text(), 'Created at')]", match: :first).click
|
|
||||||
|
|
||||||
epp_log_date = find(:xpath, "//table/tbody/tr/td[6]", match: :first).text(:all)
|
|
||||||
date_now = Date.today.to_s(:db)
|
|
||||||
|
|
||||||
assert_match /#{date_now}/, epp_log_date
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
|
@ -11,13 +11,9 @@ class AdminAreaInvoicesIntegrationTest < ApplicationIntegrationTest
|
||||||
|
|
||||||
assert_text 'Create new invoice'
|
assert_text 'Create new invoice'
|
||||||
select 'Best Names', from: 'deposit_registrar_id', match: :first
|
select 'Best Names', from: 'deposit_registrar_id', match: :first
|
||||||
|
|
||||||
fill_in 'Amount', with: '1000'
|
fill_in 'Amount', with: '1000'
|
||||||
|
|
||||||
click_on 'Save'
|
click_on 'Save'
|
||||||
|
|
||||||
# TODO
|
|
||||||
# Should be assert_text 'Record created'
|
|
||||||
assert_equal page.status_code, 200
|
assert_equal page.status_code, 200
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,60 +2,59 @@ require 'test_helper'
|
||||||
require 'application_system_test_case'
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class AdminAreaPendingDeleteIntegrationTest < JavaScriptApplicationSystemTestCase
|
class AdminAreaPendingDeleteIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
setup do
|
||||||
|
WebMock.allow_net_connect!
|
||||||
|
sign_in users(:admin)
|
||||||
|
|
||||||
setup do
|
@domain = domains(:shop)
|
||||||
WebMock.allow_net_connect!
|
@token = '123456'
|
||||||
sign_in users(:admin)
|
|
||||||
|
|
||||||
@domain = domains(:shop)
|
@domain.update!(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION],
|
||||||
@token = '123456'
|
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||||
|
registrant_verification_token: @token)
|
||||||
|
end
|
||||||
|
|
||||||
@domain.update!(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION],
|
def test_accept_pending_delete
|
||||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
visit edit_admin_domain_path(id: @domain.id)
|
||||||
registrant_verification_token: @token)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_accept_pending_delete
|
click_on 'Accept'
|
||||||
visit edit_admin_domain_path(id: @domain.id)
|
page.driver.browser.switch_to.alert.accept
|
||||||
|
|
||||||
click_on 'Accept'
|
assert_text 'Pending was successfully applied.'
|
||||||
page.driver.browser.switch_to.alert.accept
|
end
|
||||||
|
|
||||||
assert_text 'Pending was successfully applied.'
|
def test_accept_pending_delete_no_success
|
||||||
end
|
@domain.update!(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION],
|
||||||
|
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||||
|
registrant_verification_token: nil)
|
||||||
|
|
||||||
def test_accept_pending_delete_no_success
|
visit edit_admin_domain_path(id: @domain.id)
|
||||||
@domain.update!(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION],
|
|
||||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
|
||||||
registrant_verification_token: nil)
|
|
||||||
|
|
||||||
visit edit_admin_domain_path(id: @domain.id)
|
click_on 'Accept'
|
||||||
|
page.driver.browser.switch_to.alert.accept
|
||||||
|
|
||||||
click_on 'Accept'
|
assert_text 'Not success'
|
||||||
page.driver.browser.switch_to.alert.accept
|
end
|
||||||
|
|
||||||
assert_text 'Not success'
|
def test_reject_panding_delete
|
||||||
end
|
visit edit_admin_domain_path(id: @domain.id)
|
||||||
|
|
||||||
def test_reject_panding_delete
|
click_on 'Reject'
|
||||||
visit edit_admin_domain_path(id: @domain.id)
|
page.driver.browser.switch_to.alert.accept
|
||||||
|
|
||||||
click_on 'Reject'
|
assert_text 'Pending was successfully removed.'
|
||||||
page.driver.browser.switch_to.alert.accept
|
end
|
||||||
|
|
||||||
assert_text 'Pending was successfully removed.'
|
def test_accept_pending_delete_no_success
|
||||||
end
|
@domain.update!(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION],
|
||||||
|
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||||
|
registrant_verification_token: nil)
|
||||||
|
|
||||||
def test_accept_pending_delete_no_success
|
visit edit_admin_domain_path(id: @domain.id)
|
||||||
@domain.update!(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION],
|
|
||||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
|
||||||
registrant_verification_token: nil)
|
|
||||||
|
|
||||||
visit edit_admin_domain_path(id: @domain.id)
|
click_on 'Reject'
|
||||||
|
page.driver.browser.switch_to.alert.accept
|
||||||
click_on 'Reject'
|
|
||||||
page.driver.browser.switch_to.alert.accept
|
assert_text 'Not success'
|
||||||
|
end
|
||||||
assert_text 'Not success'
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -3,94 +3,94 @@ require 'application_system_test_case'
|
||||||
|
|
||||||
class AdminAreaPendingUpdateIntegrationTest < JavaScriptApplicationSystemTestCase
|
class AdminAreaPendingUpdateIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
WebMock.allow_net_connect!
|
WebMock.allow_net_connect!
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
|
|
||||||
@domain = domains(:hospital)
|
@domain = domains(:hospital)
|
||||||
|
|
||||||
@new_registrant = contacts(:jack)
|
@new_registrant = contacts(:jack)
|
||||||
@user = users(:api_bestnames)
|
@user = users(:api_bestnames)
|
||||||
@token = '123456'
|
@token = '123456'
|
||||||
|
|
||||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||||
registrant_verification_token: @token)
|
registrant_verification_token: @token)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_accept_pending_update
|
def test_accept_pending_update
|
||||||
pending_json = { new_registrant_id: @new_registrant.id,
|
pending_json = { new_registrant_id: @new_registrant.id,
|
||||||
new_registrant_name: @new_registrant.name,
|
new_registrant_name: @new_registrant.name,
|
||||||
new_registrant_email: @new_registrant.email,
|
new_registrant_email: @new_registrant.email,
|
||||||
current_user_id: @user.id }
|
current_user_id: @user.id }
|
||||||
|
|
||||||
@domain.update(pending_json: pending_json)
|
@domain.update(pending_json: pending_json)
|
||||||
@domain.reload
|
@domain.reload
|
||||||
|
|
||||||
visit edit_admin_domain_path(id: @domain.id)
|
visit edit_admin_domain_path(id: @domain.id)
|
||||||
|
|
||||||
click_on 'Accept'
|
click_on 'Accept'
|
||||||
page.driver.browser.switch_to.alert.accept
|
page.driver.browser.switch_to.alert.accept
|
||||||
|
|
||||||
assert_text 'Pending was successfully applied.'
|
assert_text 'Pending was successfully applied.'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_accept_pending_update_no_success
|
def test_accept_pending_update_no_success
|
||||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||||
registrant_verification_token: nil)
|
registrant_verification_token: nil)
|
||||||
|
|
||||||
pending_json = { new_registrant_id: @new_registrant.id,
|
pending_json = { new_registrant_id: @new_registrant.id,
|
||||||
new_registrant_name: @new_registrant.name,
|
new_registrant_name: @new_registrant.name,
|
||||||
new_registrant_email: @new_registrant.email,
|
new_registrant_email: @new_registrant.email,
|
||||||
current_user_id: @user.id,
|
current_user_id: @user.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
@domain.update(pending_json: pending_json)
|
@domain.update(pending_json: pending_json)
|
||||||
@domain.reload
|
@domain.reload
|
||||||
|
|
||||||
visit edit_admin_domain_path(id: @domain.id)
|
visit edit_admin_domain_path(id: @domain.id)
|
||||||
|
|
||||||
click_on 'Accept'
|
click_on 'Accept'
|
||||||
page.driver.browser.switch_to.alert.accept
|
page.driver.browser.switch_to.alert.accept
|
||||||
assert_text 'Not success'
|
assert_text 'Not success'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_reject_panding_update
|
def test_reject_panding_update
|
||||||
pending_json = { new_registrant_id: @new_registrant.id,
|
pending_json = { new_registrant_id: @new_registrant.id,
|
||||||
new_registrant_name: @new_registrant.name,
|
new_registrant_name: @new_registrant.name,
|
||||||
new_registrant_email: @new_registrant.email,
|
new_registrant_email: @new_registrant.email,
|
||||||
current_user_id: @user.id,
|
current_user_id: @user.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
@domain.update(pending_json: pending_json)
|
@domain.update(pending_json: pending_json)
|
||||||
@domain.reload
|
@domain.reload
|
||||||
|
|
||||||
visit edit_admin_domain_path(id: @domain.id)
|
visit edit_admin_domain_path(id: @domain.id)
|
||||||
|
|
||||||
click_on 'Reject'
|
click_on 'Reject'
|
||||||
page.driver.browser.switch_to.alert.accept
|
page.driver.browser.switch_to.alert.accept
|
||||||
assert_text 'Pending was successfully removed.'
|
assert_text 'Pending was successfully removed.'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_accept_pending_update_no_success
|
def test_accept_pending_update_no_success
|
||||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||||
registrant_verification_token: nil)
|
registrant_verification_token: nil)
|
||||||
|
|
||||||
pending_json = { new_registrant_id: @new_registrant.id,
|
pending_json = { new_registrant_id: @new_registrant.id,
|
||||||
new_registrant_name: @new_registrant.name,
|
new_registrant_name: @new_registrant.name,
|
||||||
new_registrant_email: @new_registrant.email,
|
new_registrant_email: @new_registrant.email,
|
||||||
current_user_id: @user.id,
|
current_user_id: @user.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
@domain.update(pending_json: pending_json)
|
@domain.update(pending_json: pending_json)
|
||||||
@domain.reload
|
@domain.reload
|
||||||
|
|
||||||
visit edit_admin_domain_path(id: @domain.id)
|
visit edit_admin_domain_path(id: @domain.id)
|
||||||
|
|
||||||
click_on 'Reject'
|
click_on 'Reject'
|
||||||
page.driver.browser.switch_to.alert.accept
|
page.driver.browser.switch_to.alert.accept
|
||||||
assert_text 'Not success'
|
assert_text 'Not success'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,4 +17,4 @@ class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
assert_equal new_iban, @registrar.iban
|
assert_equal new_iban, @registrar.iban
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,25 +2,22 @@ require 'test_helper'
|
||||||
require 'application_system_test_case'
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class AdminAreaReppLogsIntegrationTest < ApplicationSystemTestCase
|
class AdminAreaReppLogsIntegrationTest < ApplicationSystemTestCase
|
||||||
|
setup do
|
||||||
|
sign_in users(:admin)
|
||||||
|
end
|
||||||
|
|
||||||
setup do
|
def test_repp_logs_page
|
||||||
sign_in users(:admin)
|
visit admin_repp_logs_path
|
||||||
end
|
assert_text 'REPP log'
|
||||||
|
end
|
||||||
|
|
||||||
def test_repp_logs_page
|
def test_show_repp_log_page
|
||||||
visit admin_repp_logs_path
|
visit admin_repp_logs_path
|
||||||
assert_text 'REPP log'
|
get repp_v1_contacts_path
|
||||||
end
|
visit admin_repp_logs_path
|
||||||
|
|
||||||
|
find(:xpath, "//tbody/tr/td/a", match: :first).click
|
||||||
|
|
||||||
|
assert_text 'REPP log'
|
||||||
def test_show_repp_log_page
|
end
|
||||||
visit admin_repp_logs_path
|
end
|
||||||
get repp_v1_contacts_path
|
|
||||||
visit admin_repp_logs_path
|
|
||||||
|
|
||||||
find(:xpath, "//tbody/tr/td/a", match: :first).click
|
|
||||||
|
|
||||||
assert_text 'REPP log'
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
|
@ -45,5 +45,4 @@ class AdminAreaReservedDomainsIntegrationTest < JavaScriptApplicationSystemTestC
|
||||||
|
|
||||||
assert_text 'Domain updated!'
|
assert_text 'Domain updated!'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
|
||||||
|
|
|
@ -3,97 +3,92 @@ require 'application_system_test_case'
|
||||||
|
|
||||||
class AdminAreaWhiteIpsIntegrationTest < JavaScriptApplicationSystemTestCase
|
class AdminAreaWhiteIpsIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
WebMock.allow_net_connect!
|
WebMock.allow_net_connect!
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
|
|
||||||
@registrar = registrars(:bestnames)
|
@registrar = registrars(:bestnames)
|
||||||
@white_ip = white_ips(:one)
|
@white_ip = white_ips(:one)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Helpers ====================================
|
def test_visit_new_whitelisted_ip_page
|
||||||
def visit_new_whitelisted_ip_page
|
visit_new_whitelisted_ip_page
|
||||||
visit new_admin_registrar_white_ip_path(registrar_id: @registrar.id)
|
end
|
||||||
assert_text 'New whitelisted IP'
|
|
||||||
end
|
|
||||||
|
|
||||||
def visit_edit_whitelisted_ip_page
|
def test_create_new_whitelisted_ip
|
||||||
visit edit_admin_registrar_white_ip_path(registrar_id: @registrar.id, id: @white_ip.id)
|
visit_new_whitelisted_ip_page
|
||||||
assert_text 'Edit white IP'
|
fill_in 'IPv4', with: "127.0.0.1"
|
||||||
end
|
fill_in 'IPv6', with: "::ffff:192.0.2.1"
|
||||||
|
|
||||||
def visit_info_whitelisted_ip_page
|
find(:css, "#white_ip_interfaces_api").set(true)
|
||||||
visit admin_registrar_white_ip_path(registrar_id: @registrar.id, id: @white_ip.id)
|
find(:css, "#white_ip_interfaces_registrar").set(true)
|
||||||
assert_text 'White IP'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Tests =====================================
|
click_on 'Save'
|
||||||
|
|
||||||
def test_visit_new_whitelisted_ip_page
|
assert_text 'Record created'
|
||||||
visit_new_whitelisted_ip_page
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def test_create_new_whitelisted_ip
|
def test_failed_to_create_new_whitelisted_ip
|
||||||
visit_new_whitelisted_ip_page
|
visit_new_whitelisted_ip_page
|
||||||
fill_in 'IPv4', with: "127.0.0.1"
|
fill_in 'IPv4', with: "asdadadad.asd"
|
||||||
fill_in 'IPv6', with: "::ffff:192.0.2.1"
|
|
||||||
|
|
||||||
find(:css, "#white_ip_interfaces_api").set(true)
|
click_on 'Save'
|
||||||
find(:css, "#white_ip_interfaces_registrar").set(true)
|
|
||||||
|
|
||||||
click_on 'Save'
|
assert_text 'Failed to create record'
|
||||||
|
end
|
||||||
|
|
||||||
assert_text 'Record created'
|
def test_visit_edit_whitelisted_ip_page
|
||||||
end
|
visit_edit_whitelisted_ip_page
|
||||||
|
end
|
||||||
|
|
||||||
def test_failed_to_create_new_whitelisted_ip
|
def test_update_whitelisted_ip
|
||||||
visit_new_whitelisted_ip_page
|
visit_info_whitelisted_ip_page
|
||||||
fill_in 'IPv4', with: "asdadadad.asd"
|
click_on 'Edit'
|
||||||
|
|
||||||
click_on 'Save'
|
fill_in 'IPv4', with: "127.0.0.2"
|
||||||
|
find(:css, "#white_ip_interfaces_api").set(false)
|
||||||
|
click_on 'Save'
|
||||||
|
|
||||||
assert_text 'Failed to create record'
|
assert_text 'Record updated'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_visit_edit_whitelisted_ip_page
|
def test_failed_to_update_whitelisted_ip
|
||||||
visit_edit_whitelisted_ip_page
|
visit_info_whitelisted_ip_page
|
||||||
end
|
click_on 'Edit'
|
||||||
|
fill_in 'IPv4', with: "asdadad#"
|
||||||
|
|
||||||
def test_update_whitelisted_ip
|
click_on 'Save'
|
||||||
visit_info_whitelisted_ip_page
|
|
||||||
click_on 'Edit'
|
|
||||||
|
|
||||||
fill_in 'IPv4', with: "127.0.0.2"
|
assert_text 'Failed to update record'
|
||||||
|
end
|
||||||
|
|
||||||
find(:css, "#white_ip_interfaces_api").set(false)
|
def test_visit_info_whitelisted_ip_page
|
||||||
|
visit_info_whitelisted_ip_page
|
||||||
|
end
|
||||||
|
|
||||||
click_on 'Save'
|
def test_delete_whitelisted_ip
|
||||||
|
visit_info_whitelisted_ip_page
|
||||||
|
click_on 'Delete'
|
||||||
|
|
||||||
assert_text 'Record updated'
|
page.driver.browser.switch_to.alert.accept
|
||||||
end
|
|
||||||
|
|
||||||
def test_failed_to_update_whitelisted_ip
|
assert_text 'Record deleted'
|
||||||
visit_info_whitelisted_ip_page
|
end
|
||||||
click_on 'Edit'
|
|
||||||
|
|
||||||
fill_in 'IPv4', with: "asdadad#"
|
private
|
||||||
|
|
||||||
click_on 'Save'
|
def visit_new_whitelisted_ip_page
|
||||||
|
visit new_admin_registrar_white_ip_path(registrar_id: @registrar.id)
|
||||||
|
assert_text 'New whitelisted IP'
|
||||||
|
end
|
||||||
|
|
||||||
assert_text 'Failed to update record'
|
def visit_edit_whitelisted_ip_page
|
||||||
end
|
visit edit_admin_registrar_white_ip_path(registrar_id: @registrar.id, id: @white_ip.id)
|
||||||
|
assert_text 'Edit white IP'
|
||||||
|
end
|
||||||
|
|
||||||
def test_visit_info_whitelisted_ip_page
|
def visit_info_whitelisted_ip_page
|
||||||
visit_info_whitelisted_ip_page
|
visit admin_registrar_white_ip_path(registrar_id: @registrar.id, id: @white_ip.id)
|
||||||
end
|
assert_text 'White IP'
|
||||||
|
end
|
||||||
def test_delete_whitelisted_ip
|
end
|
||||||
visit_info_whitelisted_ip_page
|
|
||||||
|
|
||||||
click_on 'Delete'
|
|
||||||
|
|
||||||
page.driver.browser.switch_to.alert.accept
|
|
||||||
|
|
||||||
assert_text 'Record deleted'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ class AdminContactsTest < ApplicationSystemTestCase
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# admin_contact
|
|
||||||
def test_update_contact
|
def test_update_contact
|
||||||
visit admin_contact_path(id: @contact.id)
|
visit admin_contact_path(id: @contact.id)
|
||||||
assert_text "#{@contact.name}"
|
assert_text "#{@contact.name}"
|
||||||
|
|
|
@ -40,4 +40,4 @@ class AdminAreaInvoicesTest < ApplicationSystemTestCase
|
||||||
assert_current_path admin_invoice_path(@invoice)
|
assert_current_path admin_invoice_path(@invoice)
|
||||||
assert_text 'Invoice has been sent'
|
assert_text 'Invoice has been sent'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,4 +19,4 @@ class AdminAreaProtectedAreaTest < ApplicationSystemTestCase
|
||||||
assert_text 'You are already signed in'
|
assert_text 'You are already signed in'
|
||||||
assert_current_path admin_domains_path
|
assert_current_path admin_domains_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue