From cda553abfb84ca575f9fe24d546fbd2117f302a8 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Sun, 12 Mar 2017 21:04:19 -0400 Subject: [PATCH] Change tests to use default server port of 5000. --- .travis.yml | 2 +- moto/core/models.py | 6 +++--- other_langs/sqsSample.java | 2 +- other_langs/test.js | 2 +- other_langs/test.rb | 2 +- tests/test_awslambda/test_lambda.py | 2 +- tests/test_core/test_instance_metadata.py | 2 +- tests/test_core/test_moto_api.py | 2 +- tests/test_sqs/test_sqs.py | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index c58ed85f8..4783e13c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ install: - travis_retry pip install coveralls - | 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_ACCESS_KEY_ID=foobar_key fi diff --git a/moto/core/models.py b/moto/core/models.py index 9c2fc6d6b..a3a343aa7 100644 --- a/moto/core/models.py +++ b/moto/core/models.py @@ -157,7 +157,7 @@ class ServerModeMockAWS(BaseMockAWS): def reset(self): import requests - requests.post("http://localhost:8086/moto-api/reset") + requests.post("http://localhost:5000/moto-api/reset") def enable_patching(self): if self.__class__.nested_count == 1: @@ -169,12 +169,12 @@ class ServerModeMockAWS(BaseMockAWS): def fake_boto3_client(*args, **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) def fake_boto3_resource(*args, **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) self._client_patcher = mock.patch('boto3.client', fake_boto3_client) self._resource_patcher = mock.patch( diff --git a/other_langs/sqsSample.java b/other_langs/sqsSample.java index 23368272c..d303a4d27 100644 --- a/other_langs/sqsSample.java +++ b/other_langs/sqsSample.java @@ -36,7 +36,7 @@ public class S3Sample { AmazonSQS sqs = new AmazonSQSClient(); Region usWest2 = Region.getRegion(Regions.US_WEST_2); sqs.setRegion(usWest2); - sqs.setEndpoint("http://localhost:8086"); + sqs.setEndpoint("http://localhost:5000"); String queueName = "my-first-queue"; sqs.createQueue(queueName); diff --git a/other_langs/test.js b/other_langs/test.js index 65d65ae70..adc738a2d 100644 --- a/other_langs/test.js +++ b/other_langs/test.js @@ -1,6 +1,6 @@ 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 myKey = 'myBucketKey'; diff --git a/other_langs/test.rb b/other_langs/test.rb index dc5b7914b..f7d84eb1f 100644 --- a/other_langs/test.rb +++ b/other_langs/test.rb @@ -1,6 +1,6 @@ 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') puts sqs.client.list_queues() diff --git a/tests/test_awslambda/test_lambda.py b/tests/test_awslambda/test_lambda.py index 84e8a8f2b..d967c8bad 100644 --- a/tests/test_awslambda/test_lambda.py +++ b/tests/test_awslambda/test_lambda.py @@ -40,7 +40,7 @@ def lambda_handler(event, context): vol = ec2.Volume(volume_id) print('Volume - %s state=%s, size=%s' % (volume_id, vol.state, vol.size)) 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) diff --git a/tests/test_core/test_instance_metadata.py b/tests/test_core/test_instance_metadata.py index 69b9052e9..f8bf24814 100644 --- a/tests/test_core/test_instance_metadata.py +++ b/tests/test_core/test_instance_metadata.py @@ -6,7 +6,7 @@ import requests from moto import mock_ec2, settings if settings.TEST_SERVER_MODE: - BASE_URL = 'http://localhost:8086' + BASE_URL = 'http://localhost:5000' else: BASE_URL = 'http://169.254.169.254' diff --git a/tests/test_core/test_moto_api.py b/tests/test_core/test_moto_api.py index e65a92ac8..cb0ca8939 100644 --- a/tests/test_core/test_moto_api.py +++ b/tests/test_core/test_moto_api.py @@ -6,7 +6,7 @@ import requests import boto3 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 diff --git a/tests/test_sqs/test_sqs.py b/tests/test_sqs/test_sqs.py index 30e3e017b..2889e520f 100644 --- a/tests/test_sqs/test_sqs.py +++ b/tests/test_sqs/test_sqs.py @@ -77,7 +77,7 @@ def test_create_queues_in_multiple_region(): list(west2_conn.list_queues()['QueueUrls']).should.have.length_of(1) if settings.TEST_SERVER_MODE: - base_url = 'http://localhost:8086' + base_url = 'http://localhost:5000' else: 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) if settings.TEST_SERVER_MODE: - base_url = 'http://localhost:8086' + base_url = 'http://localhost:5000' else: base_url = 'https://us-west-1.queue.amazonaws.com'