Change tests to use default server port of 5000.
This commit is contained in:
parent
689adf7dbc
commit
cda553abfb
@ -14,7 +14,7 @@ install:
|
|||||||
- travis_retry pip install coveralls
|
- travis_retry pip install coveralls
|
||||||
- |
|
- |
|
||||||
if [ "$TEST_SERVER_MODE" = "true" ]; then
|
if [ "$TEST_SERVER_MODE" = "true" ]; then
|
||||||
AWS_SECRET_ACCESS_KEY=server_secret AWS_ACCESS_KEY_ID=server_key moto_server -p 8086&
|
AWS_SECRET_ACCESS_KEY=server_secret AWS_ACCESS_KEY_ID=server_key moto_server -p 5000&
|
||||||
export AWS_SECRET_ACCESS_KEY=foobar_secret
|
export AWS_SECRET_ACCESS_KEY=foobar_secret
|
||||||
export AWS_ACCESS_KEY_ID=foobar_key
|
export AWS_ACCESS_KEY_ID=foobar_key
|
||||||
fi
|
fi
|
||||||
|
@ -157,7 +157,7 @@ class ServerModeMockAWS(BaseMockAWS):
|
|||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
import requests
|
import requests
|
||||||
requests.post("http://localhost:8086/moto-api/reset")
|
requests.post("http://localhost:5000/moto-api/reset")
|
||||||
|
|
||||||
def enable_patching(self):
|
def enable_patching(self):
|
||||||
if self.__class__.nested_count == 1:
|
if self.__class__.nested_count == 1:
|
||||||
@ -169,12 +169,12 @@ class ServerModeMockAWS(BaseMockAWS):
|
|||||||
|
|
||||||
def fake_boto3_client(*args, **kwargs):
|
def fake_boto3_client(*args, **kwargs):
|
||||||
if 'endpoint_url' not in kwargs:
|
if 'endpoint_url' not in kwargs:
|
||||||
kwargs['endpoint_url'] = "http://localhost:8086"
|
kwargs['endpoint_url'] = "http://localhost:5000"
|
||||||
return real_boto3_client(*args, **kwargs)
|
return real_boto3_client(*args, **kwargs)
|
||||||
|
|
||||||
def fake_boto3_resource(*args, **kwargs):
|
def fake_boto3_resource(*args, **kwargs):
|
||||||
if 'endpoint_url' not in kwargs:
|
if 'endpoint_url' not in kwargs:
|
||||||
kwargs['endpoint_url'] = "http://localhost:8086"
|
kwargs['endpoint_url'] = "http://localhost:5000"
|
||||||
return real_boto3_resource(*args, **kwargs)
|
return real_boto3_resource(*args, **kwargs)
|
||||||
self._client_patcher = mock.patch('boto3.client', fake_boto3_client)
|
self._client_patcher = mock.patch('boto3.client', fake_boto3_client)
|
||||||
self._resource_patcher = mock.patch(
|
self._resource_patcher = mock.patch(
|
||||||
|
@ -36,7 +36,7 @@ public class S3Sample {
|
|||||||
AmazonSQS sqs = new AmazonSQSClient();
|
AmazonSQS sqs = new AmazonSQSClient();
|
||||||
Region usWest2 = Region.getRegion(Regions.US_WEST_2);
|
Region usWest2 = Region.getRegion(Regions.US_WEST_2);
|
||||||
sqs.setRegion(usWest2);
|
sqs.setRegion(usWest2);
|
||||||
sqs.setEndpoint("http://localhost:8086");
|
sqs.setEndpoint("http://localhost:5000");
|
||||||
|
|
||||||
String queueName = "my-first-queue";
|
String queueName = "my-first-queue";
|
||||||
sqs.createQueue(queueName);
|
sqs.createQueue(queueName);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var AWS = require('aws-sdk');
|
var AWS = require('aws-sdk');
|
||||||
|
|
||||||
var s3 = new AWS.S3({endpoint: "http://localhost:8086"});
|
var s3 = new AWS.S3({endpoint: "http://localhost:5000"});
|
||||||
var myBucket = 'my.unique.bucket.name';
|
var myBucket = 'my.unique.bucket.name';
|
||||||
|
|
||||||
var myKey = 'myBucketKey';
|
var myKey = 'myBucketKey';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
require 'aws-sdk'
|
require 'aws-sdk'
|
||||||
|
|
||||||
sqs = Aws::SQS::Resource.new(region: 'us-west-2', endpoint: 'http://localhost:8086')
|
sqs = Aws::SQS::Resource.new(region: 'us-west-2', endpoint: 'http://localhost:5000')
|
||||||
my_queue = sqs.create_queue(queue_name: 'my-bucket')
|
my_queue = sqs.create_queue(queue_name: 'my-bucket')
|
||||||
|
|
||||||
puts sqs.client.list_queues()
|
puts sqs.client.list_queues()
|
||||||
|
@ -40,7 +40,7 @@ def lambda_handler(event, context):
|
|||||||
vol = ec2.Volume(volume_id)
|
vol = ec2.Volume(volume_id)
|
||||||
print('Volume - %s state=%s, size=%s' % (volume_id, vol.state, vol.size))
|
print('Volume - %s state=%s, size=%s' % (volume_id, vol.state, vol.size))
|
||||||
return event
|
return event
|
||||||
""".format(base_url="localhost:8086" if settings.TEST_SERVER_MODE else "ec2.us-west-2.amazonaws.com")
|
""".format(base_url="localhost:5000" if settings.TEST_SERVER_MODE else "ec2.us-west-2.amazonaws.com")
|
||||||
return _process_lamda(pfunc)
|
return _process_lamda(pfunc)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import requests
|
|||||||
from moto import mock_ec2, settings
|
from moto import mock_ec2, settings
|
||||||
|
|
||||||
if settings.TEST_SERVER_MODE:
|
if settings.TEST_SERVER_MODE:
|
||||||
BASE_URL = 'http://localhost:8086'
|
BASE_URL = 'http://localhost:5000'
|
||||||
else:
|
else:
|
||||||
BASE_URL = 'http://169.254.169.254'
|
BASE_URL = 'http://169.254.169.254'
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import requests
|
|||||||
import boto3
|
import boto3
|
||||||
from moto import mock_sqs, settings
|
from moto import mock_sqs, settings
|
||||||
|
|
||||||
base_url = "http://localhost:8086" if settings.TEST_SERVER_MODE else "http://motoapi.amazonaws.com"
|
base_url = "http://localhost:5000" if settings.TEST_SERVER_MODE else "http://motoapi.amazonaws.com"
|
||||||
|
|
||||||
|
|
||||||
@mock_sqs
|
@mock_sqs
|
||||||
|
@ -77,7 +77,7 @@ def test_create_queues_in_multiple_region():
|
|||||||
list(west2_conn.list_queues()['QueueUrls']).should.have.length_of(1)
|
list(west2_conn.list_queues()['QueueUrls']).should.have.length_of(1)
|
||||||
|
|
||||||
if settings.TEST_SERVER_MODE:
|
if settings.TEST_SERVER_MODE:
|
||||||
base_url = 'http://localhost:8086'
|
base_url = 'http://localhost:5000'
|
||||||
else:
|
else:
|
||||||
base_url = 'https://us-west-1.queue.amazonaws.com'
|
base_url = 'https://us-west-1.queue.amazonaws.com'
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ def test_get_queue_with_prefix():
|
|||||||
queue.should.have.length_of(1)
|
queue.should.have.length_of(1)
|
||||||
|
|
||||||
if settings.TEST_SERVER_MODE:
|
if settings.TEST_SERVER_MODE:
|
||||||
base_url = 'http://localhost:8086'
|
base_url = 'http://localhost:5000'
|
||||||
else:
|
else:
|
||||||
base_url = 'https://us-west-1.queue.amazonaws.com'
|
base_url = 'https://us-west-1.queue.amazonaws.com'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user