2013-03-05 13:14:43 +00:00
|
|
|
from mock import patch
|
2013-08-03 21:21:25 +00:00
|
|
|
import sure # noqa
|
2013-03-05 13:14:43 +00:00
|
|
|
|
|
|
|
from moto.server import main
|
|
|
|
|
|
|
|
|
|
|
|
def test_wrong_arguments():
|
|
|
|
try:
|
2013-06-25 16:42:24 +00:00
|
|
|
main(["name", "test1", "test2", "test3"])
|
2013-03-05 13:14:43 +00:00
|
|
|
assert False, ("main() when called with the incorrect number of args"
|
|
|
|
" should raise a system exit")
|
|
|
|
except SystemExit:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@patch('moto.server.app.run')
|
|
|
|
def test_right_arguments(app_run):
|
2013-07-26 18:42:32 +00:00
|
|
|
main(["s3"])
|
|
|
|
app_run.assert_called_once_with(host='0.0.0.0', port=5000)
|
2013-06-25 16:42:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
@patch('moto.server.app.run')
|
|
|
|
def test_port_argument(app_run):
|
2013-07-26 18:42:32 +00:00
|
|
|
main(["s3", "--port", "8080"])
|
|
|
|
app_run.assert_called_once_with(host='0.0.0.0', port=8080)
|