added new tests

This commit is contained in:
olegphenomenon 2021-12-13 10:43:16 +02:00
parent 97876ab1c1
commit 4567e56457
5 changed files with 159 additions and 3 deletions

View file

@ -93,4 +93,70 @@ class AdminRegistrarsSystemTest < ApplicationSystemTestCase
assert_text 'Language English'
assert_text 'billing@bestnames.test'
end
def test_should_display_btn_for_set_test_date
visit admin_registrars_path
assert_button 'Set Test'
assert_no_button 'Remove Test'
end
def test_should_display_remove_test_if_there_accreditated_registrars
date = Time.zone.now - 10.minutes
api_user = @registrar.api_users.first
api_user.accreditation_date = date
api_user.accreditation_expire_date = api_user.accreditation_date + 1.year
api_user.save
visit admin_registrars_path
assert_button 'Remove Test'
end
def test_should_not_display_remove_test_if_accreditation_date_is_expired
date = Time.zone.now - 1.year - 10.minutes
api_user = @registrar.api_users.first
api_user.accreditation_date = date
api_user.accreditation_expire_date = api_user.accreditation_date + 1.year
api_user.save
visit admin_registrars_path
assert_no_button 'Remove'
end
def test_should_display_tests_button_in_registrar_deftails
visit admin_registrar_path(@registrar)
assert_button 'Set Test'
assert_no_button 'Remove Test'
end
def test_should_display_remove_test_if_there_accreditated_registrars_in_registrar_details
date = Time.zone.now - 10.minutes
api_user = @registrar.api_users.first
api_user.accreditation_date = date
api_user.accreditation_expire_date = api_user.accreditation_date + 1.year
api_user.save
visit admin_registrar_path(@registrar)
assert_button 'Remove Test'
end
def test_should_not_display_remove_test_if_accreditation_date_is_expired_in_registrar_details
date = Time.zone.now - 1.year - 10.minutes
api_user = @registrar.api_users.first
api_user.accreditation_date = date
api_user.accreditation_expire_date = api_user.accreditation_date + 1.year
api_user.save
visit admin_registrar_path(@registrar)
assert_no_button 'Remove'
end
end