mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
40 lines
1.1 KiB
Ruby
40 lines
1.1 KiB
Ruby
require 'test_helper'
|
|
|
|
class EppLogoutTest < EppTestCase
|
|
def test_success_response
|
|
post epp_logout_path, params: { frame: request_xml },
|
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
|
assert_epp_response :completed_successfully_ending_session
|
|
end
|
|
|
|
def test_ends_current_session
|
|
post epp_logout_path, params: { frame: request_xml },
|
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
|
assert_nil EppSession.find_by(session_id: 'api_bestnames')
|
|
end
|
|
|
|
def test_keeps_other_sessions_intact
|
|
post epp_logout_path, params: { frame: request_xml },
|
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
|
assert EppSession.find_by(session_id: 'api_goodnames')
|
|
end
|
|
|
|
def test_anonymous_user
|
|
post epp_logout_path, params: { frame: request_xml },
|
|
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
|
assert_epp_response :authorization_error
|
|
end
|
|
|
|
private
|
|
|
|
def request_xml
|
|
<<-XML
|
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
|
<command>
|
|
<logout/>
|
|
</command>
|
|
</epp>
|
|
XML
|
|
end
|
|
end
|