swh:1:snp:eb70f1f85391e4b077c211bec36af0061c4bf937
Raw File
Tip revision: b8c480f5b64ea7489c80c06984e951c18524f902 authored by Nicolas Dandrimont on 30 June 2017, 12:44:01 UTC
Remove more references to the old swh.storage.archiver module
Tip revision: b8c480f
test_api_client.py
# Copyright (C) 2015-2016  The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information

import unittest
import tempfile

from swh.storage.tests.test_storage import CommonTestStorage
from swh.storage.tests.server_testing import ServerTestFixture
from swh.storage.api.client import RemoteStorage
from swh.storage.api.server import app


class TestRemoteStorage(CommonTestStorage, ServerTestFixture,
                        unittest.TestCase):
    """Test the remote storage API.

    This class doesn't define any tests as we want identical
    functionality between local and remote storage. All the tests are
    therefore defined in AbstractTestStorage.
    """

    def setUp(self):
        # ServerTestFixture needs to have self.objroot for
        # setUp() method, but this field is defined in
        # AbstractTestStorage's setUp()
        # To avoid confusion, override the self.objroot to a
        # one choosen in this class.
        storage_base = tempfile.mkdtemp()
        self.config = {
            'storage': {
                'cls': 'local',
                'args': {
                    'db': 'dbname=%s' % self.dbname,
                    'objstorage': {
                        'cls': 'pathslicing',
                        'args': {
                            'root': storage_base,
                            'slicing': '0:2/2:4/4:6',
                        },
                    },
                }
            }
        }
        self.app = app
        super().setUp()
        self.storage = RemoteStorage(self.url())
        self.objroot = storage_base
back to top