Clean up querystring logic.
This commit is contained in:
parent
ffcbaf366e
commit
8b278eb05d
14 changed files with 66 additions and 35 deletions
|
|
@ -5,11 +5,12 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("autoscaling")
|
||||
|
||||
|
||||
def test_describe_autoscaling_groups():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("autoscaling")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/?Action=DescribeLaunchConfigurations')
|
||||
|
||||
res.data.should.contain('<DescribeLaunchConfigurationsResponse')
|
||||
|
|
|
|||
|
|
@ -13,13 +13,17 @@ def test_wrong_arguments():
|
|||
pass
|
||||
|
||||
|
||||
@patch('moto.server.app.run')
|
||||
def test_right_arguments(app_run):
|
||||
@patch('moto.server.run_simple')
|
||||
def test_right_arguments(run_simple):
|
||||
main(["s3"])
|
||||
app_run.assert_called_once_with(host='0.0.0.0', port=5000)
|
||||
func_call = run_simple.call_args[0]
|
||||
func_call[0].should.equal("0.0.0.0")
|
||||
func_call[1].should.equal(5000)
|
||||
|
||||
|
||||
@patch('moto.server.app.run')
|
||||
def test_port_argument(app_run):
|
||||
@patch('moto.server.run_simple')
|
||||
def test_port_argument(run_simple):
|
||||
main(["s3", "--port", "8080"])
|
||||
app_run.assert_called_once_with(host='0.0.0.0', port=8080)
|
||||
func_call = run_simple.call_args[0]
|
||||
func_call[0].should.equal("0.0.0.0")
|
||||
func_call[1].should.equal(8080)
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("dynamodb")
|
||||
|
||||
|
||||
def test_table_list():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("dynamodb")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/')
|
||||
res.status_code.should.equal(404)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("ec2")
|
||||
|
||||
|
||||
def test_ec2_server_get():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("ec2")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/?Action=RunInstances&ImageId=ami-60a54009')
|
||||
|
||||
groups = re.search("<instanceId>(.*)</instanceId>", res.data)
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("elb")
|
||||
|
||||
|
||||
def test_elb_describe_instances():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("elb")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/?Action=DescribeLoadBalancers')
|
||||
|
||||
res.data.should.contain('DescribeLoadBalancersResponse')
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("emr")
|
||||
|
||||
|
||||
def test_describe_jobflows():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("emr")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/?Action=DescribeJobFlows')
|
||||
|
||||
res.data.should.contain('<DescribeJobFlowsResult>')
|
||||
|
|
|
|||
|
|
@ -5,18 +5,21 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("s3")
|
||||
|
||||
|
||||
def test_s3_server_get():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("s3")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/')
|
||||
|
||||
res.data.should.contain('ListAllMyBucketsResult')
|
||||
|
||||
|
||||
def test_s3_server_bucket_create():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("s3")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.put('/', 'http://foobar.localhost:5000/')
|
||||
res.status_code.should.equal(200)
|
||||
|
||||
|
|
@ -36,7 +39,9 @@ def test_s3_server_bucket_create():
|
|||
|
||||
|
||||
def test_s3_server_post_to_bucket():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("s3")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.put('/', 'http://foobar.localhost:5000/')
|
||||
res.status_code.should.equal(200)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,18 +5,21 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("s3bucket_path")
|
||||
|
||||
|
||||
def test_s3_server_get():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("s3bucket_path")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/')
|
||||
|
||||
res.data.should.contain('ListAllMyBucketsResult')
|
||||
|
||||
|
||||
def test_s3_server_bucket_create():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("s3bucket_path")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.put('/foobar', 'http://localhost:5000')
|
||||
res.status_code.should.equal(200)
|
||||
|
||||
|
|
@ -36,7 +39,9 @@ def test_s3_server_bucket_create():
|
|||
|
||||
|
||||
def test_s3_server_post_to_bucket():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("s3bucket_path")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.put('/foobar', 'http://localhost:5000/')
|
||||
res.status_code.should.equal(200)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("ses")
|
||||
|
||||
|
||||
def test_ses_list_identities():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("ses")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/?Action=ListIdentities')
|
||||
res.data.should.contain("ListIdentitiesResponse")
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("sqs")
|
||||
|
||||
|
||||
def test_sqs_list_identities():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("sqs")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/?Action=ListQueues')
|
||||
res.data.should.contain("ListQueuesResponse")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ import moto.server as server
|
|||
'''
|
||||
Test the different server responses
|
||||
'''
|
||||
server.configure_urls("sts")
|
||||
|
||||
|
||||
def test_sts_get_session_token():
|
||||
test_client = server.app.test_client()
|
||||
backend = server.create_backend_app("sts")
|
||||
test_client = backend.test_client()
|
||||
|
||||
res = test_client.get('/?Action=GetSessionToken')
|
||||
res.status_code.should.equal(200)
|
||||
res.data.should.contain("SessionToken")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue