# Path: oioswift/common/middleware/hashedcontainer.py
# class HashedContainerMiddleware(AutoContainerBase):
#     BYPASS_QS = "bypass-autocontainer"
#     BYPASS_HEADER = "X-bypass-autocontainer"
#     TRUE_VALUES = ["true", "yes", "1"]
#     EXTRA_KEYWORDS = ['offset', 'size', 'bits']
#     def __init__(self, app, ns, acct, proxy=None,
#                  strip_v1=False, account_first=False,
#                  skip_metadata=False, **kwargs):
# def filter_factory(global_conf, **local_config):
#     def factory(app):


import os.path
import sys
import unittest
from swift.common import swob, utils
from swift.common.swob import Request
from oioswift.common.middleware import hashedcontainer
from oio.cli.common import clientmanager
from test.unit.common.middleware.helpers import FakeSwift  # noqa: E402
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Hack PYTHONPATH so "test" is swift's test directory
sys.path.insert(1, os.path.abspath(os.path.join(__file__, '../../../../..')))  # noqa


class TestHashedContainer(unittest.TestCase):

    GLOBAL_CONF = {
        'sds_namespace': 'OPENIO',
        'sds_default_account': 'OPENIO',
        'sds_proxy_url': '127.0.0.1:666'
    }

    def setUp(self):
        self.app = FakeSwift()
        # prevent a call to oio-proxy
        clientmanager.ClientManager.nsinfo = {
            'options': {'flat_bitlength': '17'}}

# Path: oioswift/common/middleware/hashedcontainer.py
# class HashedContainerMiddleware(AutoContainerBase):
#     BYPASS_QS = "bypass-autocontainer"
#     BYPASS_HEADER = "X-bypass-autocontainer"
#     TRUE_VALUES = ["true", "yes", "1"]
#     EXTRA_KEYWORDS = ['offset', 'size', 'bits']
#     def __init__(self, app, ns, acct, proxy=None,
#                  strip_v1=False, account_first=False,
#                  skip_metadata=False, **kwargs):
# def filter_factory(global_conf, **local_config):
#     def factory(app):


# Path: tests/unit/common/middleware/test_hashedcontainer.py
import os.path
import sys
import unittest
from swift.common import swob, utils
from swift.common.swob import Request
from oioswift.common.middleware import hashedcontainer
from oio.cli.common import clientmanager
from test.unit.common.middleware.helpers import FakeSwift  # noqa: E402

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Hack PYTHONPATH so "test" is swift's test directory
sys.path.insert(1, os.path.abspath(os.path.join(__file__, '../../../../..')))  # noqa


class TestHashedContainer(unittest.TestCase):

    GLOBAL_CONF = {
        'sds_namespace': 'OPENIO',
        'sds_default_account': 'OPENIO',
        'sds_proxy_url': '127.0.0.1:666'
    }

    def setUp(self):
        self.app = FakeSwift()
        # prevent a call to oio-proxy
        clientmanager.ClientManager.nsinfo = {
            'options': {'flat_bitlength': '17'}}

        self.hc = hashedcontainer.filter_factory(self.GLOBAL_CONF)(self.app)