def test_upload_key_with_hash_prefix(self):
    bucket_name = ('hash-%s' % short_uid())
    self.s3_client.create_bucket(Bucket=bucket_name)
    key_name = '#key-with-hash-prefix'
    content = b'test 123'
    self.s3_client.put_object(Bucket=bucket_name, Key=key_name, Body=content)
    downloaded_object = self.s3_client.get_object(Bucket=bucket_name, Key=key_name)
    downloaded_content = to_str(downloaded_object['Body'].read())
    self.assertEqual(to_str(downloaded_content), to_str(content))
    self._delete_bucket(bucket_name, [key_name])
    with self.assertRaises(Exception):
        self.s3_client.head_object(Bucket=bucket_name, Key=key_name)
def test_upload_key_with_hash_prefix(self):
    bucket_name = ('hash-%s' % short_uid())
    self.s3_client.create_bucket(Bucket=bucket_name)
    key_name = '#key-with-hash-prefix'
    content = b'test 123'
    self.s3_client.put_object(Bucket=bucket_name, Key=key_name, Body=content)
    downloaded_object = self.s3_client.get_object(Bucket=bucket_name, Key=key_name)
    downloaded_content = to_str(downloaded_object['Body'].read())
    self.assertEqual(to_str(downloaded_content), to_str(content))
    self._delete_bucket(bucket_name, [key_name])
    with self.assertRaises(Exception):
        self.s3_client.head_object(Bucket=bucket_name, Key=key_name)