Exemplo n.º 1
0
import sure  # flake8: noqa

import moto.server as server

'''
Test the different server responses
'''
server.configure_urls("dynamodb")


def test_table_list():
    test_client = server.app.test_client()
    res = test_client.get('/')
    res.status_code.should.equal(404)

    headers = {'X-Amz-Target': 'TestTable.ListTables'}
    res = test_client.get('/', headers=headers)
    res.data.should.contain('TableNames')
Exemplo n.º 2
0
import sure  # noqa

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()
    res = test_client.get('/?Action=GetSessionToken')
    res.status_code.should.equal(200)
    res.data.should.contain("SessionToken")
    res.data.should.contain("AccessKeyId")
Exemplo n.º 3
0
import sure  # noqa

import moto.server as server

'''
Test the different server responses
'''
server.configure_urls("dynamodb")


def test_table_list():
    test_client = server.app.test_client()
    res = test_client.get('/')
    res.status_code.should.equal(404)

    headers = {'X-Amz-Target': 'TestTable.ListTables'}
    res = test_client.get('/', headers=headers)
    res.data.should.contain('TableNames')
Exemplo n.º 4
0
import sure  # noqa

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()
    res = test_client.get('/?Action=GetSessionToken')
    res.status_code.should.equal(200)
    res.data.should.contain("SessionToken")
    res.data.should.contain("AccessKeyId")
Exemplo n.º 5
0
import sure  # noqa

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()
    res = test_client.get('/?Action=DescribeLoadBalancers')

    res.data.should.contain('DescribeLoadBalancersResponse')
    res.data.should.contain('LoadBalancerName')
Exemplo n.º 6
0
import sure  # noqa

import moto.server as server
'''
Test the different server responses
'''
server.configure_urls("emr")


def test_describe_jobflows():
    test_client = server.app.test_client()
    res = test_client.get('/?Action=DescribeJobFlows')

    res.data.should.contain('<DescribeJobFlowsResult>')
    res.data.should.contain('<JobFlows>')
Exemplo n.º 7
0
import sure  # noqa

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()
    res = test_client.get('/?Action=DescribeLoadBalancers')

    res.data.should.contain('DescribeLoadBalancersResponse')
    res.data.should.contain('LoadBalancerName')
Exemplo n.º 8
0
import sure  # noqa

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()
    res = test_client.get('/')

    res.data.should.contain('ListAllMyBucketsResult')


def test_s3_server_bucket_create():
    test_client = server.app.test_client()
    res = test_client.put('/foobar', 'http://localhost:5000')
    res.status_code.should.equal(200)

    res = test_client.get('/')
    res.data.should.contain('<Name>foobar</Name>')

    res = test_client.get('/foobar', 'http://localhost:5000')
    res.status_code.should.equal(200)
    res.data.should.contain("ListBucketResult")

    res = test_client.put('/foobar/bar', 'http://localhost:5000', data='test value')
    res.status_code.should.equal(200)
Exemplo n.º 9
0
import sure  # noqa

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()
    res = test_client.get('/')

    res.data.should.contain('ListAllMyBucketsResult')


def test_s3_server_bucket_create():
    test_client = server.app.test_client()
    res = test_client.put('/', 'http://foobar.localhost:5000/')
    res.status_code.should.equal(200)

    res = test_client.get('/')
    res.data.should.contain('<Name>foobar</Name>')

    res = test_client.get('/', 'http://foobar.localhost:5000/')
    res.status_code.should.equal(200)
    res.data.should.contain("ListBucketResult")

    res = test_client.put('/bar', 'http://foobar.localhost:5000/', data='test value')
    res.status_code.should.equal(200)
Exemplo n.º 10
0
import sure  # noqa

import moto.server as server

'''
Test the different server responses
'''
server.configure_urls("emr")


def test_describe_jobflows():
    test_client = server.app.test_client()
    res = test_client.get('/?Action=DescribeJobFlows')

    res.data.should.contain('<DescribeJobFlowsResult>')
    res.data.should.contain('<JobFlows>')
Exemplo n.º 11
0
import re
import sure  # flake8: noqa

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()
    res = test_client.get('/?Action=RunInstances&ImageId=ami-60a54009')

    groups = re.search("<instanceId>(.*)</instanceId>", res.data)
    instance_id = groups.groups()[0]

    res = test_client.get('/?Action=DescribeInstances')
    res.data.should.contain(instance_id)
Exemplo n.º 12
0
import sure  # noqa

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()
    res = test_client.get('/')

    res.data.should.contain('ListAllMyBucketsResult')


def test_s3_server_bucket_create():
    test_client = server.app.test_client()
    res = test_client.put('/', 'http://foobar.localhost:5000/')
    res.status_code.should.equal(200)

    res = test_client.get('/')
    res.data.should.contain('<Name>foobar</Name>')

    res = test_client.get('/', 'http://foobar.localhost:5000/')
    res.status_code.should.equal(200)
    res.data.should.contain("ListBucketResult")

    res = test_client.put('/bar',
                          'http://foobar.localhost:5000/',
                          data='test value')
Exemplo n.º 13
0
import re
import sure  # noqa

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()
    res = test_client.get('/?Action=RunInstances&ImageId=ami-60a54009')

    groups = re.search("<instanceId>(.*)</instanceId>", res.data)
    instance_id = groups.groups()[0]

    res = test_client.get('/?Action=DescribeInstances')
    res.data.should.contain(instance_id)
Exemplo n.º 14
0
import sure  # noqa

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()
    res = test_client.get('/?Action=DescribeLaunchConfigurations')

    res.data.should.contain('<DescribeLaunchConfigurationsResponse')
    res.data.should.contain('<LaunchConfigurations>')