From cf5bd7665cff971b8f0e470e96773bcbe1e5ad36 Mon Sep 17 00:00:00 2001 From: Lorenz Hufnagel Date: Fri, 16 Nov 2018 12:23:39 +0100 Subject: [PATCH] Mock AWS credentials https://github.com/spulec/moto/issues/1924 --- .travis.yml | 2 -- moto/core/models.py | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a5de0fa2728..d386102fc2a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,6 @@ matrix: sudo: true before_install: - export BOTO_CONFIG=/dev/null - - export AWS_SECRET_ACCESS_KEY=foobar_secret - - export AWS_ACCESS_KEY_ID=foobar_key install: # We build moto first so the docker container doesn't try to compile it as well, also note we don't use # -d for docker run so the logs show up in travis diff --git a/moto/core/models.py b/moto/core/models.py index 19267ca08860..9fe1e96bd32b 100644 --- a/moto/core/models.py +++ b/moto/core/models.py @@ -4,6 +4,7 @@ import functools import inspect +import os import re import six from io import BytesIO @@ -21,6 +22,11 @@ ) +# "Mock" the AWS credentials as they can't be mocked in Botocore currently +os.environ.setdefault("AWS_ACCESS_KEY_ID", "foobar_key") +os.environ.setdefault("AWS_SECRET_ACCESS_KEY", "foobar_secret") + + class BaseMockAWS(object): nested_count = 0