Adding server mode
This commit is contained in:
parent
c6f5afff75
commit
a728b2581a
31 changed files with 489 additions and 66 deletions
19
tests/test_core/test_server.py
Normal file
19
tests/test_core/test_server.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from mock import patch
|
||||
import sure # flake8: noqa
|
||||
|
||||
from moto.server import main
|
||||
|
||||
|
||||
def test_wrong_arguments():
|
||||
try:
|
||||
main(["name", "test1", "test2"])
|
||||
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):
|
||||
main(["name", "s3"])
|
||||
app_run.assert_called_once_with()
|
||||
20
tests/test_core/test_url_mapping.py
Normal file
20
tests/test_core/test_url_mapping.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import sure # flake8: noqa
|
||||
|
||||
from moto.core.utils import convert_regex_to_flask_path
|
||||
|
||||
|
||||
def test_flask_path_converting_simple():
|
||||
convert_regex_to_flask_path("/").should.equal("/")
|
||||
convert_regex_to_flask_path("/$").should.equal("/")
|
||||
|
||||
convert_regex_to_flask_path("/foo").should.equal("/foo")
|
||||
|
||||
convert_regex_to_flask_path("/foo/bar/").should.equal("/foo/bar/")
|
||||
|
||||
|
||||
def test_flask_path_converting_regex():
|
||||
convert_regex_to_flask_path("/(?P<key_name>\w+)").should.equal('/<regex("\w+"):key_name>')
|
||||
|
||||
convert_regex_to_flask_path("(?P<account_id>\d+)/(?P<queue_name>.*)$").should.equal(
|
||||
'<regex("\d+"):account_id>/<regex(".*"):queue_name>'
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue