示例#1
0
    def setUp(self):
        """Setup."""
        yield super(TestWithDatabase, self).setUp()
        # most of these tests require a "test" bucket to be avaialble,
        # but don't create it using the s3 api...
        self.s4_site.resource._add_bucket("test")

        users = (
            (0, u'usr0', 'pass0'),
            (1, u'usr1', 'pass1'),
            (2, u'usr2', 'pass2'),
            (3, u'usr3', 'pass3'),
        )
        for user_id, username, password in users:
            user = create_test_user(
                id=user_id, username=username, password=password)
            setattr(self, username, user)
            # set the password in the object just as a test simplifier
            user.password = password

        # tune the config for this tests
        self.patch(settings.api_server, 'MULTIPART_THRESHOLD', 1024 * 1024 * 5)
        self.patch(settings.api_server, 'STORAGE_CHUNK_SIZE', 1024 * 64)

        self.addCleanup(setattr, METER_UTILITY, 'service_meter', None)
示例#2
0
    def setUp(self):
        """Setup."""
        yield super(TestWithDatabase, self).setUp()
        # most of these tests require a "test" bucket to be avaialble,
        # but don't create it using the s3 api...
        self.s4_site.resource._add_bucket("test")

        users = (
            (0, u'usr0', u'shard0', 'pass0'),
            (1, u'usr1', u'shard1', 'pass1'),
            (2, u'usr2', u'shard2', 'pass2'),
            (3, u'usr3', u'shard0', 'pass3'),
        )
        for user_id, username, shard_id, password in users:
            user = create_test_user(id=user_id, username=username,
                                    password=password, shard_id=shard_id)
            setattr(self, username, user)
            # set the password in the object just as a test simplifier
            user.password = password

        # tune the config for this tests
        self.patch(config.api_server, 'multipart_threshold', 1024 * 1024 * 5)
        self.patch(config.api_server, 'storage_chunk_size', 1024 * 64)