def setUp(self):
        super(S3APITestCase, self).setUp()
        self.flags(buckets_path=os.path.join(OSS_TEMPDIR, 'buckets'),
                   s3_host='127.0.0.1')

        shutil.rmtree(FLAGS.buckets_path)
        os.mkdir(FLAGS.buckets_path)

        router = s3server.S3Application(FLAGS.buckets_path)
        self.server = wsgi.Server("S3 Objectstore",
                                  router,
                                  host=FLAGS.s3_host,
                                  port=FLAGS.s3_port)
        self.server.start()

        if not boto.config.has_section('Boto'):
            boto.config.add_section('Boto')

        boto.config.set('Boto', 'num_retries', '0')
        conn = s3.S3Connection(aws_access_key_id='fake',
                               aws_secret_access_key='fake',
                               host=FLAGS.s3_host,
                               port=FLAGS.s3_port,
                               is_secure=False,
                               calling_format=s3.OrdinaryCallingFormat())
        self.conn = conn

        def get_http_connection(host, is_secure):
            """Get a new S3 connection, don't attempt to reuse connections."""
            return self.conn.new_http_connection(host, is_secure)

        self.conn.get_http_connection = get_http_connection
Setup users, projects, and start a test server.
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/tests/test_objectstore.py/S3APITestCase.setUp