test: wrote tests for zone_test and domain_version, also remove useless test for job

This commit is contained in:
Oleg Hasjanov 2021-03-04 18:32:09 +02:00
parent 3a77e420bd
commit 5841883a15
3 changed files with 32 additions and 20 deletions

View file

@ -1,16 +0,0 @@
require "test_helper"
class RegistrantChangeExpiredEmailJobTest < ActiveSupport::TestCase
include ActionMailer::TestHelper
setup do
ActionMailer::Base.deliveries.clear
@domain = domains(:shop)
end
def test_delivers_email
# This job doesn't use anymore, but I'll leave it here for statistics
assert RegistrantChangeExpiredEmailJob.enqueue(@domain.id)
assert_emails 0
end
end

View file

@ -178,10 +178,6 @@ class DNS::ZoneTest < ActiveSupport::TestCase
assert_nil Whois::Record.find_by(name: subzone.origin) assert_nil Whois::Record.find_by(name: subzone.origin)
end end
def test_generate_zonefile
end
private private
def valid_zone def valid_zone

View file

@ -5,6 +5,7 @@ class DomainVersionsTest < ApplicationSystemTestCase
super super
@registrar = registrars(:bestnames) @registrar = registrars(:bestnames)
@domain = domains(:shop)
create_domain_with_history create_domain_with_history
sign_in users(:admin) sign_in users(:admin)
@ -59,4 +60,35 @@ class DomainVersionsTest < ApplicationSystemTestCase
assert_text 'Best Names' assert_text 'Best Names'
assert_text '23.04.18, 18:50 update 1-AdminUser' assert_text '23.04.18, 18:50 update 1-AdminUser'
end end
def test_search_registrant_param
visit admin_domain_versions_path
fill_in 'Registrant', with: @domain.registrant, match: :first
find('.btn.btn-primary').click
assert_equal current_url,
'http://www.example.com/admin/domain_versions?q[name]=&q[registrant]=John&q[registrar]=&q[event]=&results_per_page='
end
def test_search_registrar_param
visit admin_domain_versions_path
find('#q_registrar').set(@domain.registrar)
find('.btn.btn-primary').click
assert_equal current_url,
'http://www.example.com/admin/domain_versions?q[name]=&q[registrant]=&q[registrar]=Best+Names&q[event]=&results_per_page='
end
def test_search_name_param
visit admin_domain_versions_path
fill_in 'Name', with: @domain.name, match: :first
find('.btn.btn-primary').click
assert_equal current_url,
'http://www.example.com/admin/domain_versions?q[name]=shop.test&q[registrant]=&q[registrar]=&q[event]=&results_per_page='
end
def test_search_event_param
# TODO
end
end end