'Simulate a FileField with an S3 storage which uses keys rather than
folders and names. FileField and Storage shouldn\'t have any os.path()
calls that break the key.'

def test_filefield_awss3_storage(self):

    storage = AWSS3Storage()
    folder = 'not/a/folder/'
    f = FileField(upload_to=folder, storage=storage)
    key = 'my-file-key\\with    odd    characters'
    data = ContentFile('test')
    expected_key = ((AWSS3Storage.prefix + folder) + key)
    result_key = f.generate_filename(None, key)
    self.assertEqual(result_key, expected_key)
    result_key = storage.save(result_key, data)
    self.assertEqual(result_key, expected_key)
    def upload_to(instance, filename):
        return (folder + filename)
    f = FileField(upload_to=upload_to, storage=storage)
    result_key = f.generate_filename(None, key)
    self.assertEqual(result_key, expected_key)
    result_key = storage.save(result_key, data)
    self.assertEqual(result_key, expected_key)
