<s> from __future__ import unicode_literals <EOL> from mock import patch <EOL> import sure <EOL> from moto . server import main , create_backend_app , DomainDispatcherApplication <EOL> def test_wrong_arguments ( ) : <EOL> try : <EOL> main ( [ "<STR_LIT:name>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> assert False , ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> except SystemExit : <EOL> pass <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_right_arguments ( run_simple ) : <EOL> main ( [ "<STR_LIT>" ] ) <EOL> func_call = run_simple . call_args [ <NUM_LIT:0> ] <EOL> func_call [ <NUM_LIT:0> ] . should . equal ( "<STR_LIT>" ) <EOL> func_call [ <NUM_LIT:1> ] . should . equal ( <NUM_LIT> ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_port_argument ( run_simple ) : <EOL> main ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> func_call = run_simple . call_args [ <NUM_LIT:0> ] <EOL> func_call [ <NUM_LIT:0> ] . should . equal ( "<STR_LIT>" ) <EOL> func_call [ <NUM_LIT:1> ] . should . equal ( <NUM_LIT> ) <EOL> def test_domain_dispatched ( ) : <EOL> dispatcher = DomainDispatcherApplication ( create_backend_app ) <EOL> backend_app = dispatcher . get_application ( "<STR_LIT>" ) <EOL> keys = list ( backend_app . view_functions . keys ( ) ) <EOL> keys [ <NUM_LIT:0> ] . should . equal ( '<STR_LIT>' ) <EOL> def test_domain_without_matches ( ) : <EOL> dispatcher = DomainDispatcherApplication ( create_backend_app ) <EOL> dispatcher . get_application . when . called_with ( "<STR_LIT>" ) . should . throw ( RuntimeError ) <EOL> def test_domain_dispatched_with_service ( ) : <EOL> dispatcher = DomainDispatcherApplication ( create_backend_app , service = "<STR_LIT>" ) <EOL> backend_app = dispatcher . get_application ( "<STR_LIT>" ) <EOL> keys = set ( backend_app . view_functions . keys ( ) ) <EOL> keys . should . contain ( '<STR_LIT>' ) </s>
