<s> import unittest <EOL> from aiorest_ws . decorators import endpoint <EOL> from aiorest_ws . exceptions import NotSupportedArgumentType <EOL> from aiorest_ws . serializers import JSONSerializer <EOL> class EndpointTestCase ( unittest . TestCase ) : <EOL> def test_create_handler_with_str_method_name ( self ) : <EOL> @ endpoint ( '<STR_LIT>' , '<STR_LIT:GET>' ) <EOL> def fake_handler ( request , * args , ** kwargs ) : <EOL> pass <EOL> path , handler , methods , name = fake_handler ( ) <EOL> self . assertEqual ( methods , '<STR_LIT:GET>' ) <EOL> def test_create_handler_with_list_method_name ( self ) : <EOL> @ endpoint ( '<STR_LIT>' , [ '<STR_LIT:GET>' , '<STR_LIT>' ] ) <EOL> def fake_handler ( request , * args , ** kwargs ) : <EOL> pass <EOL> path , handler , methods , name = fake_handler ( ) <EOL> self . assertEqual ( methods , [ '<STR_LIT:GET>' , '<STR_LIT>' ] ) <EOL> def test_set_attr_for_endpoint ( self ) : <EOL> @ endpoint ( '<STR_LIT>' , [ '<STR_LIT:GET>' , '<STR_LIT>' ] , serializers = ( JSONSerializer , ) ) <EOL> def fake_handler ( request , * args , ** kwargs ) : <EOL> pass <EOL> path , handler , methods , name = fake_handler ( ) <EOL> self . assertEqual ( handler . serializers , ( JSONSerializer , ) ) <EOL> def test_create_handler_with_invalid_method_type ( self ) : <EOL> @ endpoint ( '<STR_LIT>' , None ) <EOL> def fake_handler ( request , * args , ** kwargs ) : <EOL> pass <EOL> self . assertRaises ( NotSupportedArgumentType , fake_handler ) </s>
