moto/tests/test_core/test_server.py

30 lines
760 B
Python
Raw Normal View History

2013-03-05 08:14:43 -05:00
from mock import patch
2013-08-03 17:21:25 -04:00
import sure # noqa
2013-03-05 08:14:43 -05:00
from moto.server import main
def test_wrong_arguments():
try:
2013-06-25 12:42:24 -04:00
main(["name", "test1", "test2", "test3"])
2013-03-05 08:14:43 -05:00
assert False, ("main() when called with the incorrect number of args"
" should raise a system exit")
except SystemExit:
pass
2013-12-28 20:15:37 -05:00
@patch('moto.server.run_simple')
def test_right_arguments(run_simple):
main(["s3"])
2013-12-28 20:15:37 -05:00
func_call = run_simple.call_args[0]
func_call[0].should.equal("0.0.0.0")
func_call[1].should.equal(5000)
2013-06-25 12:42:24 -04:00
2013-12-28 20:15:37 -05:00
@patch('moto.server.run_simple')
def test_port_argument(run_simple):
main(["s3", "--port", "8080"])
2013-12-28 20:15:37 -05:00
func_call = run_simple.call_args[0]
func_call[0].should.equal("0.0.0.0")
func_call[1].should.equal(8080)