require 'test_helper' class EppDomainUpdateRemDnsTest < EppTestCase include ActionMailer::TestHelper include ActiveJob::TestHelper setup do @domain = domains(:shop) @contact = contacts(:john) @dnskey = dnskeys(:one) @dnskey.update(domain: @domain) @original_registrant_change_verification = Setting.request_confirmation_on_registrant_change_enabled ActionMailer::Base.deliveries.clear end teardown do Setting.request_confirmation_on_registrant_change_enabled = @original_registrant_change_verification end def test_remove_dnskey_if_explicitly_set request_xml = <<-XML shop.test f0ff7d17b0 #{@dnskey.flags} #{@dnskey.protocol} #{@dnskey.alg} #{@dnskey.public_key} XML post epp_update_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_correct_against_schema response_xml @domain.reload assert_equal 0, @domain.dnskeys.count assert_epp_response :completed_successfully end def test_remove_dnskey_if_remove_all request_xml = <<-XML shop.test f0ff7d17b0 true XML post epp_update_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_correct_against_schema response_xml @domain.reload assert_equal 0, @domain.dnskeys.count assert_epp_response :completed_successfully end end