require 'test_helper' class EppLoginCredentialsTest < EppTestCase def test_correct_credentials request_xml = <<-XML test_bestnames testtest 1.0 en https://epp.tld.ee/schema/domain-eis-1.0.xsd https://epp.tld.ee/schema/contact-ee-1.1.xsd urn:ietf:params:xml:ns:host-1.0 XML post epp_login_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=new_session_id' } assert EppSession.find_by(session_id: 'new_session_id') assert_equal users(:api_bestnames), EppSession.find_by(session_id: 'new_session_id').user assert_epp_response :completed_successfully end def test_already_logged_in assert true # Handled by EPP proxy end def test_wrong_credentials request_xml = <<-XML non-existent valid-but-wrong 1.0 en https://epp.tld.ee/schema/domain-eis-1.0.xsd https://epp.tld.ee/schema/contact-ee-1.1.xsd urn:ietf:params:xml:ns:host-1.0 XML post epp_login_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=any_random_string' } assert_epp_response :authentication_error_server_closing_connection end end