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
|
||||
|
|
|
@ -36,4 +36,4 @@ class AdminAreaAccountActivitiesIntegrationTest < ApplicationSystemTestCase
|
|||
response.headers['Content-Disposition']
|
||||
assert_not_empty response.body
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
@ -103,4 +101,4 @@ class AdminAreaAdminUsersIntegrationTest < JavaScriptApplicationSystemTestCase
|
|||
|
||||
assert_text 'Record deleted'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
||||
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
|
||||
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
|
||||
@apiuser = users(:api_bestnames)
|
||||
@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")
|
||||
end
|
||||
@apiuser = users(:api_bestnames)
|
||||
@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")
|
||||
end
|
||||
|
||||
# Helpers =======================
|
||||
def show_certificate_info
|
||||
visit admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||
assert_text 'Certificates'
|
||||
end
|
||||
def test_show_certificate_info
|
||||
show_certificate_info
|
||||
end
|
||||
|
||||
# TESTs ===========================
|
||||
def test_show_certificate_info
|
||||
show_certificate_info
|
||||
end
|
||||
def test_destroy_certificate
|
||||
show_certificate_info
|
||||
find(:xpath, "//a[text()='Delete']").click
|
||||
|
||||
def test_destroy_certificate
|
||||
show_certificate_info
|
||||
find(:xpath, "//a[text()='Delete']").click
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Record deleted'
|
||||
end
|
||||
|
||||
assert_text 'Record deleted'
|
||||
end
|
||||
def test_download_csr
|
||||
get download_csr_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||
|
||||
def test_download_csr
|
||||
get download_csr_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.csr.pem\"; filename*=UTF-8''test_bestnames.csr.pem", response.headers['Content-Disposition']
|
||||
assert_not_empty response.body
|
||||
end
|
||||
assert_response :ok
|
||||
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_not_empty response.body
|
||||
end
|
||||
|
||||
def test_download_crt
|
||||
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_download_crt
|
||||
get download_crt_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||
|
||||
def test_failed_to_revoke_certificate
|
||||
show_certificate_info
|
||||
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
|
||||
|
||||
find(:xpath, "//a[text()='Revoke this certificate']").click
|
||||
assert_text 'Failed to update record'
|
||||
end
|
||||
def test_failed_to_revoke_certificate
|
||||
show_certificate_info
|
||||
|
||||
def test_new_api_user
|
||||
visit new_admin_registrar_api_user_path(registrar_id: registrars(:bestnames).id)
|
||||
find(:xpath, "//a[text()='Revoke this certificate']").click
|
||||
assert_text 'Failed to update record'
|
||||
end
|
||||
|
||||
fill_in 'Username', with: 'testapiuser'
|
||||
fill_in 'Password', with: 'secretpassword'
|
||||
fill_in 'Identity code', with: '60305062718'
|
||||
def test_new_api_user
|
||||
visit new_admin_registrar_api_user_path(registrar_id: registrars(:bestnames).id)
|
||||
|
||||
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'
|
||||
end
|
||||
click_on 'Create API user'
|
||||
|
||||
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'
|
||||
|
||||
class AdminEppLogsIntegrationTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
end
|
||||
setup do
|
||||
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>
|
||||
def test_visit_epp_logs_page
|
||||
visit admin_epp_logs_path
|
||||
assert_text 'EPP log'
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
def test_visit_epp_logs_page
|
||||
visit admin_epp_logs_path
|
||||
assert_text 'EPP log'
|
||||
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
|
||||
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,60 +2,59 @@ require 'test_helper'
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaPendingDeleteIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
@domain = domains(:shop)
|
||||
@token = '123456'
|
||||
|
||||
@domain = domains(:shop)
|
||||
@token = '123456'
|
||||
@domain.update!(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION],
|
||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||
registrant_verification_token: @token)
|
||||
end
|
||||
|
||||
@domain.update!(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION],
|
||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||
registrant_verification_token: @token)
|
||||
end
|
||||
def test_accept_pending_delete
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
|
||||
def test_accept_pending_delete
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
click_on 'Accept'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
click_on 'Accept'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Pending was successfully applied.'
|
||||
end
|
||||
|
||||
assert_text 'Pending was successfully applied.'
|
||||
end
|
||||
def test_accept_pending_delete_no_success
|
||||
@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
|
||||
@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)
|
||||
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
click_on 'Accept'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
click_on 'Accept'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Not success'
|
||||
end
|
||||
|
||||
assert_text 'Not success'
|
||||
end
|
||||
def test_reject_panding_delete
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
|
||||
def test_reject_panding_delete
|
||||
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 'Pending was successfully removed.'
|
||||
end
|
||||
|
||||
assert_text 'Pending was successfully removed.'
|
||||
end
|
||||
def test_accept_pending_delete_no_success
|
||||
@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
|
||||
@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)
|
||||
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
|
||||
click_on 'Reject'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
assert_text 'Not success'
|
||||
end
|
||||
end
|
||||
click_on 'Reject'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
assert_text 'Not success'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,94 +3,94 @@ require 'application_system_test_case'
|
|||
|
||||
class AdminAreaPendingUpdateIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
|
||||
@domain = domains(:hospital)
|
||||
@domain = domains(:hospital)
|
||||
|
||||
@new_registrant = contacts(:jack)
|
||||
@user = users(:api_bestnames)
|
||||
@token = '123456'
|
||||
@new_registrant = contacts(:jack)
|
||||
@user = users(:api_bestnames)
|
||||
@token = '123456'
|
||||
|
||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||
registrant_verification_token: @token)
|
||||
end
|
||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||
registrant_verification_token: @token)
|
||||
end
|
||||
|
||||
def test_accept_pending_update
|
||||
pending_json = { new_registrant_id: @new_registrant.id,
|
||||
new_registrant_name: @new_registrant.name,
|
||||
new_registrant_email: @new_registrant.email,
|
||||
current_user_id: @user.id }
|
||||
def test_accept_pending_update
|
||||
pending_json = { new_registrant_id: @new_registrant.id,
|
||||
new_registrant_name: @new_registrant.name,
|
||||
new_registrant_email: @new_registrant.email,
|
||||
current_user_id: @user.id }
|
||||
|
||||
@domain.update(pending_json: pending_json)
|
||||
@domain.reload
|
||||
@domain.update(pending_json: pending_json)
|
||||
@domain.reload
|
||||
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
|
||||
click_on 'Accept'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
click_on 'Accept'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
assert_text 'Pending was successfully applied.'
|
||||
end
|
||||
assert_text 'Pending was successfully applied.'
|
||||
end
|
||||
|
||||
def test_accept_pending_update_no_success
|
||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||
registrant_verification_token: nil)
|
||||
def test_accept_pending_update_no_success
|
||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||
registrant_verification_token: nil)
|
||||
|
||||
pending_json = { new_registrant_id: @new_registrant.id,
|
||||
new_registrant_name: @new_registrant.name,
|
||||
new_registrant_email: @new_registrant.email,
|
||||
current_user_id: @user.id,
|
||||
}
|
||||
pending_json = { new_registrant_id: @new_registrant.id,
|
||||
new_registrant_name: @new_registrant.name,
|
||||
new_registrant_email: @new_registrant.email,
|
||||
current_user_id: @user.id,
|
||||
}
|
||||
|
||||
@domain.update(pending_json: pending_json)
|
||||
@domain.reload
|
||||
@domain.update(pending_json: pending_json)
|
||||
@domain.reload
|
||||
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
|
||||
click_on 'Accept'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Not success'
|
||||
end
|
||||
click_on 'Accept'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Not success'
|
||||
end
|
||||
|
||||
def test_reject_panding_update
|
||||
pending_json = { new_registrant_id: @new_registrant.id,
|
||||
new_registrant_name: @new_registrant.name,
|
||||
new_registrant_email: @new_registrant.email,
|
||||
current_user_id: @user.id,
|
||||
}
|
||||
def test_reject_panding_update
|
||||
pending_json = { new_registrant_id: @new_registrant.id,
|
||||
new_registrant_name: @new_registrant.name,
|
||||
new_registrant_email: @new_registrant.email,
|
||||
current_user_id: @user.id,
|
||||
}
|
||||
|
||||
@domain.update(pending_json: pending_json)
|
||||
@domain.reload
|
||||
@domain.update(pending_json: pending_json)
|
||||
@domain.reload
|
||||
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
|
||||
click_on 'Reject'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Pending was successfully removed.'
|
||||
end
|
||||
click_on 'Reject'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Pending was successfully removed.'
|
||||
end
|
||||
|
||||
def test_accept_pending_update_no_success
|
||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||
registrant_verification_token: nil)
|
||||
def test_accept_pending_update_no_success
|
||||
@domain.update!(statuses: [DomainStatus::PENDING_UPDATE],
|
||||
registrant_verification_asked_at: Time.zone.now - 1.day,
|
||||
registrant_verification_token: nil)
|
||||
|
||||
pending_json = { new_registrant_id: @new_registrant.id,
|
||||
new_registrant_name: @new_registrant.name,
|
||||
new_registrant_email: @new_registrant.email,
|
||||
current_user_id: @user.id,
|
||||
}
|
||||
pending_json = { new_registrant_id: @new_registrant.id,
|
||||
new_registrant_name: @new_registrant.name,
|
||||
new_registrant_email: @new_registrant.email,
|
||||
current_user_id: @user.id,
|
||||
}
|
||||
|
||||
@domain.update(pending_json: pending_json)
|
||||
@domain.reload
|
||||
@domain.update(pending_json: pending_json)
|
||||
@domain.reload
|
||||
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
visit edit_admin_domain_path(id: @domain.id)
|
||||
|
||||
click_on 'Reject'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Not success'
|
||||
end
|
||||
end
|
||||
click_on 'Reject'
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
assert_text 'Not success'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,4 +17,4 @@ class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest
|
|||
|
||||
assert_equal new_iban, @registrar.iban
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,25 +2,22 @@ require 'test_helper'
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaReppLogsIntegrationTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
end
|
||||
def test_repp_logs_page
|
||||
visit admin_repp_logs_path
|
||||
assert_text 'REPP log'
|
||||
end
|
||||
|
||||
def test_repp_logs_page
|
||||
visit admin_repp_logs_path
|
||||
assert_text 'REPP log'
|
||||
end
|
||||
def test_show_repp_log_page
|
||||
visit admin_repp_logs_path
|
||||
get repp_v1_contacts_path
|
||||
visit admin_repp_logs_path
|
||||
|
||||
find(:xpath, "//tbody/tr/td/a", match: :first).click
|
||||
|
||||
|
||||
def test_show_repp_log_page
|
||||
visit admin_repp_logs_path
|
||||
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
|
||||
assert_text 'REPP log'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,5 +45,4 @@ class AdminAreaReservedDomainsIntegrationTest < JavaScriptApplicationSystemTestC
|
|||
|
||||
assert_text 'Domain updated!'
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,97 +3,92 @@ require 'application_system_test_case'
|
|||
|
||||
class AdminAreaWhiteIpsIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
setup do
|
||||
WebMock.allow_net_connect!
|
||||
sign_in users(:admin)
|
||||
|
||||
@registrar = registrars(:bestnames)
|
||||
@white_ip = white_ips(:one)
|
||||
end
|
||||
@registrar = registrars(:bestnames)
|
||||
@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 test_visit_new_whitelisted_ip_page
|
||||
visit_new_whitelisted_ip_page
|
||||
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 test_create_new_whitelisted_ip
|
||||
visit_new_whitelisted_ip_page
|
||||
fill_in 'IPv4', with: "127.0.0.1"
|
||||
fill_in 'IPv6', with: "::ffff:192.0.2.1"
|
||||
|
||||
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
|
||||
find(:css, "#white_ip_interfaces_api").set(true)
|
||||
find(:css, "#white_ip_interfaces_registrar").set(true)
|
||||
|
||||
# Tests =====================================
|
||||
click_on 'Save'
|
||||
|
||||
def test_visit_new_whitelisted_ip_page
|
||||
visit_new_whitelisted_ip_page
|
||||
end
|
||||
assert_text 'Record created'
|
||||
end
|
||||
|
||||
def test_create_new_whitelisted_ip
|
||||
visit_new_whitelisted_ip_page
|
||||
fill_in 'IPv4', with: "127.0.0.1"
|
||||
fill_in 'IPv6', with: "::ffff:192.0.2.1"
|
||||
def test_failed_to_create_new_whitelisted_ip
|
||||
visit_new_whitelisted_ip_page
|
||||
fill_in 'IPv4', with: "asdadadad.asd"
|
||||
|
||||
find(:css, "#white_ip_interfaces_api").set(true)
|
||||
find(:css, "#white_ip_interfaces_registrar").set(true)
|
||||
click_on 'Save'
|
||||
|
||||
click_on 'Save'
|
||||
assert_text 'Failed to create record'
|
||||
end
|
||||
|
||||
assert_text 'Record created'
|
||||
end
|
||||
def test_visit_edit_whitelisted_ip_page
|
||||
visit_edit_whitelisted_ip_page
|
||||
end
|
||||
|
||||
def test_failed_to_create_new_whitelisted_ip
|
||||
visit_new_whitelisted_ip_page
|
||||
fill_in 'IPv4', with: "asdadadad.asd"
|
||||
def test_update_whitelisted_ip
|
||||
visit_info_whitelisted_ip_page
|
||||
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'
|
||||
end
|
||||
assert_text 'Record updated'
|
||||
end
|
||||
|
||||
def test_visit_edit_whitelisted_ip_page
|
||||
visit_edit_whitelisted_ip_page
|
||||
end
|
||||
def test_failed_to_update_whitelisted_ip
|
||||
visit_info_whitelisted_ip_page
|
||||
click_on 'Edit'
|
||||
fill_in 'IPv4', with: "asdadad#"
|
||||
|
||||
def test_update_whitelisted_ip
|
||||
visit_info_whitelisted_ip_page
|
||||
click_on 'Edit'
|
||||
click_on 'Save'
|
||||
|
||||
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'
|
||||
end
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
|
||||
def test_failed_to_update_whitelisted_ip
|
||||
visit_info_whitelisted_ip_page
|
||||
click_on 'Edit'
|
||||
assert_text 'Record deleted'
|
||||
end
|
||||
|
||||
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'
|
||||
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 test_visit_info_whitelisted_ip_page
|
||||
visit_info_whitelisted_ip_page
|
||||
end
|
||||
|
||||
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
|
||||
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}"
|
||||
|
|
|
@ -40,4 +40,4 @@ class AdminAreaInvoicesTest < ApplicationSystemTestCase
|
|||
assert_current_path admin_invoice_path(@invoice)
|
||||
assert_text 'Invoice has been sent'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,4 +19,4 @@ class AdminAreaProtectedAreaTest < ApplicationSystemTestCase
|
|||
assert_text 'You are already signed in'
|
||||
assert_current_path admin_domains_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue