# Path: storages/backends/s3boto.py
# ACCESS_KEY_NAME = getattr(settings, 'AWS_S3_ACCESS_KEY_ID', getattr(settings, 'AWS_ACCESS_KEY_ID', None))
# SECRET_KEY_NAME = getattr(settings, 'AWS_S3_SECRET_ACCESS_KEY', getattr(settings, 'AWS_SECRET_ACCESS_KEY', None))
# HEADERS = getattr(settings, 'AWS_HEADERS', {})
# STORAGE_BUCKET_NAME = getattr(settings, 'AWS_STORAGE_BUCKET_NAME', None)
# AUTO_CREATE_BUCKET = getattr(settings, 'AWS_AUTO_CREATE_BUCKET', False)
# DEFAULT_ACL = getattr(settings, 'AWS_DEFAULT_ACL', 'public-read')
# BUCKET_ACL = getattr(settings, 'AWS_BUCKET_ACL', DEFAULT_ACL)
# QUERYSTRING_AUTH = getattr(settings, 'AWS_QUERYSTRING_AUTH', True)
# QUERYSTRING_EXPIRE = getattr(settings, 'AWS_QUERYSTRING_EXPIRE', 3600)
# REDUCED_REDUNDANCY = getattr(settings, 'AWS_REDUCED_REDUNDANCY', False)
# LOCATION = getattr(settings, 'AWS_LOCATION', '')
# CUSTOM_DOMAIN = getattr(settings, 'AWS_S3_CUSTOM_DOMAIN', None)
# CALLING_FORMAT = getattr(settings, 'AWS_S3_CALLING_FORMAT',
#                          SubdomainCallingFormat())
# SECURE_URLS = getattr(settings, 'AWS_S3_SECURE_URLS', True)
# FILE_NAME_CHARSET = getattr(settings, 'AWS_S3_FILE_NAME_CHARSET', 'utf-8')
# FILE_OVERWRITE = getattr(settings, 'AWS_S3_FILE_OVERWRITE', True)
# FILE_BUFFER_SIZE = getattr(settings, 'AWS_S3_FILE_BUFFER_SIZE', 5242880)
# IS_GZIPPED = getattr(settings, 'AWS_IS_GZIPPED', False)
# PRELOAD_METADATA = getattr(settings, 'AWS_PRELOAD_METADATA', False)
# GZIP_CONTENT_TYPES = getattr(settings, 'GZIP_CONTENT_TYPES', (
#     'text/css',
#     'application/javascript',
#     'application/x-javascript',
# ))
# MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
#                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
# DATESTR_RE = re.compile(r"^.+, (?P<day>\d{1,2}) (?P<month_name>%s) (?P<year>\d{4}) (?P<hour>\d{1,2}):(?P<minute>\d{1,2}):(?P<second>\d{1,2}) (GMT|UTC)$" % ("|".join(MONTH_NAMES)))
# def safe_join(base, *paths):
# def _parse_datestring(dstr):
#     def __init__(self, bucket=STORAGE_BUCKET_NAME, access_key=None,
#             secret_key=None, bucket_acl=BUCKET_ACL, acl=DEFAULT_ACL,
#             headers=HEADERS, gzip=IS_GZIPPED,
#             gzip_content_types=GZIP_CONTENT_TYPES,
#             querystring_auth=QUERYSTRING_AUTH,
#             querystring_expire=QUERYSTRING_EXPIRE,
#             reduced_redundancy=REDUCED_REDUNDANCY,
#             custom_domain=CUSTOM_DOMAIN,
#             secure_urls=SECURE_URLS,
#             location=LOCATION,
#             file_name_charset=FILE_NAME_CHARSET,
#             preload_metadata=PRELOAD_METADATA,
#             calling_format=CALLING_FORMAT):
#     def bucket(self):
#     def entries(self):
#     def _get_access_keys(self):
#     def _get_or_create_bucket(self, name):
#     def _clean_name(self, name):
#     def _normalize_name(self, name):
#     def _encode_name(self, name):
#     def _decode_name(self, name):
#     def _compress_content(self, content):
#     def _open(self, name, mode='rb'):
#     def _save(self, name, content):
#     def delete(self, name):
#     def exists(self, name):
#     def listdir(self, name):
#     def size(self, name):
#     def modified_time(self, name):
#     def url(self, name):
#     def get_available_name(self, name):
#     def __init__(self, name, mode, storage, buffer_size=FILE_BUFFER_SIZE):
#     def size(self):
#     def file(self):
#     def read(self, *args, **kwargs):
#     def write(self, *args, **kwargs):
#     def _buffer_file_size(self):
#     def _flush_write_buffer(self):
#     def close(self):
# class S3BotoStorage(Storage):
# class S3BotoStorageFile(File):


import os
import mock
from uuid import uuid4
from urllib2 import urlopen
from django.test import TestCase
from django.core.files.base import ContentFile
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from boto.s3.key import Key
from storages.backends import s3boto

    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
"""




__all__ = (
    'SafeJoinTest',
    'S3BotoStorageTests',
    #'S3BotoStorageFileTests',
)

class S3BotoTestCase(TestCase):
    @mock.patch('storages.backends.s3boto.S3Connection')
    def setUp(self, S3Connection):
        self.storage = s3boto.S3BotoStorage()


class SafeJoinTest(TestCase):
    def test_normal(self):

# Path: storages/backends/s3boto.py
# ACCESS_KEY_NAME = getattr(settings, 'AWS_S3_ACCESS_KEY_ID', getattr(settings, 'AWS_ACCESS_KEY_ID', None))
# SECRET_KEY_NAME = getattr(settings, 'AWS_S3_SECRET_ACCESS_KEY', getattr(settings, 'AWS_SECRET_ACCESS_KEY', None))
# HEADERS = getattr(settings, 'AWS_HEADERS', {})
# STORAGE_BUCKET_NAME = getattr(settings, 'AWS_STORAGE_BUCKET_NAME', None)
# AUTO_CREATE_BUCKET = getattr(settings, 'AWS_AUTO_CREATE_BUCKET', False)
# DEFAULT_ACL = getattr(settings, 'AWS_DEFAULT_ACL', 'public-read')
# BUCKET_ACL = getattr(settings, 'AWS_BUCKET_ACL', DEFAULT_ACL)
# QUERYSTRING_AUTH = getattr(settings, 'AWS_QUERYSTRING_AUTH', True)
# QUERYSTRING_EXPIRE = getattr(settings, 'AWS_QUERYSTRING_EXPIRE', 3600)
# REDUCED_REDUNDANCY = getattr(settings, 'AWS_REDUCED_REDUNDANCY', False)
# LOCATION = getattr(settings, 'AWS_LOCATION', '')
# CUSTOM_DOMAIN = getattr(settings, 'AWS_S3_CUSTOM_DOMAIN', None)
# CALLING_FORMAT = getattr(settings, 'AWS_S3_CALLING_FORMAT',
#                          SubdomainCallingFormat())
# SECURE_URLS = getattr(settings, 'AWS_S3_SECURE_URLS', True)
# FILE_NAME_CHARSET = getattr(settings, 'AWS_S3_FILE_NAME_CHARSET', 'utf-8')
# FILE_OVERWRITE = getattr(settings, 'AWS_S3_FILE_OVERWRITE', True)
# FILE_BUFFER_SIZE = getattr(settings, 'AWS_S3_FILE_BUFFER_SIZE', 5242880)
# IS_GZIPPED = getattr(settings, 'AWS_IS_GZIPPED', False)
# PRELOAD_METADATA = getattr(settings, 'AWS_PRELOAD_METADATA', False)
# GZIP_CONTENT_TYPES = getattr(settings, 'GZIP_CONTENT_TYPES', (
#     'text/css',
#     'application/javascript',
#     'application/x-javascript',
# ))
# MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
#                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
# DATESTR_RE = re.compile(r"^.+, (?P<day>\d{1,2}) (?P<month_name>%s) (?P<year>\d{4}) (?P<hour>\d{1,2}):(?P<minute>\d{1,2}):(?P<second>\d{1,2}) (GMT|UTC)$" % ("|".join(MONTH_NAMES)))
# def safe_join(base, *paths):
# def _parse_datestring(dstr):
#     def __init__(self, bucket=STORAGE_BUCKET_NAME, access_key=None,
#             secret_key=None, bucket_acl=BUCKET_ACL, acl=DEFAULT_ACL,
#             headers=HEADERS, gzip=IS_GZIPPED,
#             gzip_content_types=GZIP_CONTENT_TYPES,
#             querystring_auth=QUERYSTRING_AUTH,
#             querystring_expire=QUERYSTRING_EXPIRE,
#             reduced_redundancy=REDUCED_REDUNDANCY,
#             custom_domain=CUSTOM_DOMAIN,
#             secure_urls=SECURE_URLS,
#             location=LOCATION,
#             file_name_charset=FILE_NAME_CHARSET,
#             preload_metadata=PRELOAD_METADATA,
#             calling_format=CALLING_FORMAT):
#     def bucket(self):
#     def entries(self):
#     def _get_access_keys(self):
#     def _get_or_create_bucket(self, name):
#     def _clean_name(self, name):
#     def _normalize_name(self, name):
#     def _encode_name(self, name):
#     def _decode_name(self, name):
#     def _compress_content(self, content):
#     def _open(self, name, mode='rb'):
#     def _save(self, name, content):
#     def delete(self, name):
#     def exists(self, name):
#     def listdir(self, name):
#     def size(self, name):
#     def modified_time(self, name):
#     def url(self, name):
#     def get_available_name(self, name):
#     def __init__(self, name, mode, storage, buffer_size=FILE_BUFFER_SIZE):
#     def size(self):
#     def file(self):
#     def read(self, *args, **kwargs):
#     def write(self, *args, **kwargs):
#     def _buffer_file_size(self):
#     def _flush_write_buffer(self):
#     def close(self):
# class S3BotoStorage(Storage):
# class S3BotoStorageFile(File):


# Path: storages/tests/s3boto.py
import os
import mock
from uuid import uuid4
from urllib2 import urlopen
from django.test import TestCase
from django.core.files.base import ContentFile
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from boto.s3.key import Key
from storages.backends import s3boto

    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
"""




__all__ = (
    'SafeJoinTest',
    'S3BotoStorageTests',
    #'S3BotoStorageFileTests',
)

class S3BotoTestCase(TestCase):
    @mock.patch('storages.backends.s3boto.S3Connection')
    def setUp(self, S3Connection):
        self.storage = s3boto.S3BotoStorage()


class SafeJoinTest(TestCase):
    def test_normal(self):

        path = s3boto.safe_join("", "path/to/somewhere", "other", "path/to/somewhere")
