# Path: swf/settings.py
# def from_env():
#     """Retrieves AWS settings from environment.
# 
#     Supported environment variables are:
#         - `AWS_ACCESS_KEY_ID`
#         - `AWS_SECRET_ACCESS_KEY`
#         - `AWS_DEFAULT_REGION`
# 
#     :rtype: dict
# 
#     """
#     hsh = {}
# 
#     if "AWS_ACCESS_KEY_ID" in os.environ:
#         hsh["aws_access_key_id"] = os.environ["AWS_ACCESS_KEY_ID"]
#         hsh["aws_secret_access_key"] = os.environ.get("AWS_SECRET_ACCESS_KEY")
# 
#     if "AWS_DEFAULT_REGION" in os.environ:
#         hsh["region"] = os.environ["AWS_DEFAULT_REGION"]
# 
#     return hsh


import os
import unittest
from swf.settings import from_env
            os.environ.pop(key, None)

    def tearDown(self):
        for key in AWS_ENV_KEYS:
            if self.oldies[key]:
                os.environ[key] = self.oldies[key]
            else:
                os.environ.pop(key, None)

    def test_get_aws_settings_with_access_key_id(self):
        """
        If AWS_ACCESS_KEY_ID is set, get all 3 params from env.
        """
        os.environ["AWS_ACCESS_KEY_ID"] = "foo"
        os.environ["AWS_SECRET_ACCESS_KEY"] = "bar"
        os.environ["AWS_DEFAULT_REGION"] = "eu-west-1"
        _settings = from_env()
        self.assertEqual(_settings, {
            "aws_access_key_id": "foo",
            "aws_secret_access_key": "bar",
            "region": "eu-west-1",
        })

    def test_get_aws_settings_without_access_key_id(self):
        """
        If AWS_DEFAULT_REGION is not set, get AWS_DEFAULT_REGION from env anyway if there.
        """
        self.assertEqual(from_env(), {})

        os.environ["AWS_DEFAULT_REGION"] = "eu-west-1"

# Path: swf/settings.py
# def from_env():
#     """Retrieves AWS settings from environment.
# 
#     Supported environment variables are:
#         - `AWS_ACCESS_KEY_ID`
#         - `AWS_SECRET_ACCESS_KEY`
#         - `AWS_DEFAULT_REGION`
# 
#     :rtype: dict
# 
#     """
#     hsh = {}
# 
#     if "AWS_ACCESS_KEY_ID" in os.environ:
#         hsh["aws_access_key_id"] = os.environ["AWS_ACCESS_KEY_ID"]
#         hsh["aws_secret_access_key"] = os.environ.get("AWS_SECRET_ACCESS_KEY")
# 
#     if "AWS_DEFAULT_REGION" in os.environ:
#         hsh["region"] = os.environ["AWS_DEFAULT_REGION"]
# 
#     return hsh


# Path: tests/test_settings.py
import os
import unittest
from swf.settings import from_env

            os.environ.pop(key, None)

    def tearDown(self):
        for key in AWS_ENV_KEYS:
            if self.oldies[key]:
                os.environ[key] = self.oldies[key]
            else:
                os.environ.pop(key, None)

    def test_get_aws_settings_with_access_key_id(self):
        """
        If AWS_ACCESS_KEY_ID is set, get all 3 params from env.
        """
        os.environ["AWS_ACCESS_KEY_ID"] = "foo"
        os.environ["AWS_SECRET_ACCESS_KEY"] = "bar"
        os.environ["AWS_DEFAULT_REGION"] = "eu-west-1"
        _settings = from_env()
        self.assertEqual(_settings, {
            "aws_access_key_id": "foo",
            "aws_secret_access_key": "bar",
            "region": "eu-west-1",
        })

    def test_get_aws_settings_without_access_key_id(self):
        """
        If AWS_DEFAULT_REGION is not set, get AWS_DEFAULT_REGION from env anyway if there.
        """
        self.assertEqual(from_env(), {})

        os.environ["AWS_DEFAULT_REGION"] = "eu-west-1"

        self.assertEqual(from_env(), {