<s> from awscli . testutils import unittest <EOL> from awscli . customizations . s3endpoint import on_top_level_args_parsed <EOL> from botocore . utils import fix_s3_host <EOL> import mock <EOL> class TestS3EndpointURL ( unittest . TestCase ) : <EOL> def test_endpoint_url_unregisters_fix_s3_host ( self ) : <EOL> args = mock . Mock ( ) <EOL> args . endpoint_url = '<STR_LIT>' <EOL> args . command = '<STR_LIT>' <EOL> event_handler = mock . Mock ( ) <EOL> on_top_level_args_parsed ( args , event_handler ) <EOL> event_handler . unregister . assert_called_with ( '<STR_LIT>' , fix_s3_host ) <EOL> def test_unregister_not_called_for_no_endpoint ( self ) : <EOL> args = mock . Mock ( ) <EOL> args . endpoint_url = None <EOL> event_handler = mock . Mock ( ) <EOL> on_top_level_args_parsed ( args , event_handler ) <EOL> self . assertFalse ( event_handler . unregister . called ) <EOL> def test_endpoint_url_set_but_not_for_s3 ( self ) : <EOL> args = mock . Mock ( ) <EOL> args . endpoint_url = '<STR_LIT>' <EOL> args . command = '<STR_LIT>' <EOL> event_handler = mock . Mock ( ) <EOL> on_top_level_args_parsed ( args , event_handler ) <EOL> self . assertFalse ( event_handler . unregister . called ) </s>
