def test_wrong_arguments(): try: main(["name", "test1", "test2", "test3"]) assert False, ("main() when called with the incorrect number of args" " should raise a system exit") except SystemExit: pass
def setUp(self): import threading from moto.server import main t = threading.Thread(name="moto_thread", target=lambda: main([])) t.daemon = True # UI lives at http://localhost:5000/moto-api t.start()
def test_port_argument(app_run): main(["name", "s3", 8080]) app_run.assert_called_once_with(port=8080)
def test_right_arguments(app_run): main(["name", "s3"]) app_run.assert_called_once_with(port=None)
def test_port_argument(run_simple): main(["s3", "--port", "8080"]) func_call = run_simple.call_args[0] func_call[0].should.equal("127.0.0.1") func_call[1].should.equal(8080)
def test_right_arguments(run_simple): main(["s3"]) func_call = run_simple.call_args[0] func_call[0].should.equal("127.0.0.1") func_call[1].should.equal(5000)
import sys import argparse import moto.server as server # Replace moto emr with the custom emr implementation sys.modules['moto.emr.urls'] = __import__('localemr.urls') if __name__ == "__main__": parser = argparse.ArgumentParser( description="Local AWS EMR - A local service that imitates AWS EMR ") parser.add_argument('-p', '--port', help='Port to run the service on', type=int, default=3000) parser.add_argument("-H", "--host", type=str, help="Which host to bind", default="0.0.0.0") args = parser.parse_args() server.main(['emr', '-H', args.host, '--port', str(args.port)])
def test_port_argument(app_run): main(["s3", "--port", "8080"]) app_run.assert_called_once_with(host='0.0.0.0', port=8080)
def test_right_arguments(app_run): main(["s3"]) app_run.assert_called_once_with(host='0.0.0.0', port=5000)
import moto.server as server import sys # Replace moto s3 with the custom s3 implementation sys.modules['moto.s3.urls'] = __import__('ros3.urls') if __name__ == "__main__": server.main(['s3', *sys.argv[1:]])
def thread_func(params): return moto_server.main( [api, '-p', str(port), '-H', constants.BIND_HOST])
def thread_func(params): if localstack_config.FORWARD_EDGE_INMEM: return moto_server.main( ["-p", str(port), "-H", constants.BIND_HOST]) return moto_server.main( [api, "-p", str(port), "-H", constants.BIND_HOST])