updated tests

This commit is contained in:
olegphenomenon 2021-12-23 15:14:36 +02:00
parent ba48132547
commit d9f6274258
3 changed files with 73 additions and 89 deletions

View file

@ -717,49 +717,51 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_no_emails assert_no_emails
end end
def test_makes_update_if_was_forcedelete # COMMENT OU REASON: FOR EXPIRED DOMAIN SHOULD NOT SET FD
contact = @domain.contacts.first # def test_makes_update_if_was_forcedelete
contact.update_attribute(:email, '`@outlook.test') # contact = @domain.contacts.first
contact.verify_email # contact.update_attribute(:email, '`@outlook.test')
assert contact.email_verification_failed? # contact.verify_email
@domain.reload # assert contact.email_verification_failed?
assert @domain.force_delete_scheduled? # @domain.reload
#
@domain.update_attribute(:statuses_before_force_delete, nil) # assert @domain.force_delete_scheduled?
#
Setting.request_confirmation_on_registrant_change_enabled = true # @domain.update_attribute(:statuses_before_force_delete, nil)
new_registrant = contacts(:william).becomes(Registrant) #
assert_not_equal new_registrant, @domain.registrant # Setting.request_confirmation_on_registrant_change_enabled = true
# new_registrant = contacts(:william).becomes(Registrant)
request_xml = <<-XML # assert_not_equal new_registrant, @domain.registrant
<?xml version="1.0" encoding="UTF-8" standalone="no"?> #
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee', for_version: '1.0')}"> # request_xml = <<-XML
<command> # <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<update> # <epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee', for_version: '1.0')}">
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee', for_version: '1.2')}"> # <command>
<domain:name>#{@domain.name}</domain:name> # <update>
<domain:chg> # <domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee', for_version: '1.2')}">
<domain:registrant verified="yes">#{new_registrant.code}</domain:registrant> # <domain:name>#{@domain.name}</domain:name>
</domain:chg> # <domain:chg>
</domain:update> # <domain:registrant verified="yes">#{new_registrant.code}</domain:registrant>
</update> # </domain:chg>
<extension> # </domain:update>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis', for_version: '1.0')}"> # </update>
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument> # <extension>
</eis:extdata> # <eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis', for_version: '1.0')}">
</extension> # <eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</command> # </eis:extdata>
</epp> # </extension>
XML # </command>
# </epp>
post epp_update_path, params: { frame: request_xml }, # XML
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } #
@domain.reload # post epp_update_path, params: { frame: request_xml },
# headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body) # @domain.reload
assert_correct_against_schema response_xml #
assert_epp_response :completed_successfully # response_xml = Nokogiri::XML(response.body)
end # assert_correct_against_schema response_xml
# assert_epp_response :completed_successfully
# end
def test_clears_force_delete_when_registrar_changed def test_clears_force_delete_when_registrar_changed
Setting.request_confirmation_on_registrant_change_enabled = true Setting.request_confirmation_on_registrant_change_enabled = true

View file

@ -29,31 +29,32 @@ class DomainExpireMailerTest < ActionMailer::TestCase
email.subject email.subject
end end
def test_delivers_domain_expiration_soft_email_if_auto_fd # COMMENT OU REASON: FOR EXPIRED DOMAIN SHOULD NOT SET FD
domain = domains(:shop) # def test_delivers_domain_expiration_soft_email_if_auto_fd
email_address = domain.registrar.email # domain = domains(:shop)
assert_not domain.force_delete_scheduled? # email_address = domain.registrar.email
travel_to Time.zone.parse('2010-07-05') # assert_not domain.force_delete_scheduled?
email = '`@internet.ee' # travel_to Time.zone.parse('2010-07-05')
# email = '`@internet.ee'
Truemail.configure.default_validation_type = :regex #
# Truemail.configure.default_validation_type = :regex
contact = domain.admin_contacts.first #
contact.update_attribute(:email, email) # contact = domain.admin_contacts.first
contact.verify_email # contact.update_attribute(:email, email)
# contact.verify_email
assert contact.email_verification_failed? #
# assert contact.email_verification_failed?
domain.reload #
# domain.reload
assert domain.force_delete_scheduled? #
# assert_no domain.force_delete_scheduled?
email = DomainExpireMailer.expired_soft(domain: domain, #
registrar: domain.registrar, # email = DomainExpireMailer.expired_soft(domain: domain,
email: email_address).deliver_now # registrar: domain.registrar,
# email: email_address).deliver_now
assert_emails 1 #
assert_equal I18n.t("domain_expire_mailer.expired_soft.subject", domain_name: domain.name), # assert_emails 1
email.subject # assert_equal I18n.t("domain_expire_mailer.expired_soft.subject", domain_name: domain.name),
end # email.subject
# end
end end

View file

@ -100,25 +100,6 @@ class VerifyEmailTaskTest < ActiveJob::TestCase
# assert_equal ValidationEvent.all.count, 9 # assert_equal ValidationEvent.all.count, 9
# end # end
def test_should_set_fd_for_failed_email_after_several_times
contact = contacts(:john)
trumail_results = OpenStruct.new(success: false,
email: contact.email,
domain: "inbox.tests",
errors: {:mx=>"target host(s) not found"},
)
Spy.on_instance_method(Actions::EmailCheck, :check_email).and_return(trumail_results)
assert_not contact.domains.last.force_delete_scheduled?
3.times do
run_task
end
assert contact.domains.last.force_delete_scheduled?
end
def test_fd_should_not_removed_if_change_email_to_another_invalid_one def test_fd_should_not_removed_if_change_email_to_another_invalid_one
contact = contacts(:john) contact = contacts(:john)