Beispiel #1
0
 def get_unique_url(self, public_url_security, public_url_alphabet):
     l = public_url_security
     while 1:
         candidate = get_random_word(length=l, alphabet=public_url_alphabet)
         if self.public_path(candidate) is None:
             return candidate
         l += 1
Beispiel #2
0
 def get_unique_url(self, public_url_security, public_url_alphabet):
     l = public_url_security
     while 1:
         candidate = get_random_word(length=l, alphabet=public_url_alphabet)
         if self.public_path(candidate) is None:
             return candidate
         l +=1
Beispiel #3
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from mock import call
from functools import wraps, partial

import uuid as uuidlib

from pithos.backends.random_word import get_random_word


serial = 0

get_random_data = lambda length: get_random_word(length)[:length]
get_random_name = partial(get_random_word, length=8)


def assert_issue_commission_calls(func):
    @wraps(func)
    def wrapper(tc):
        assert isinstance(tc, TestQuotaMixin)
        tc.expected_issue_commission_calls = []
        func(tc)
        tc.assertEqual(tc.b.astakosclient.issue_one_commission.mock_calls,
                       tc.expected_issue_commission_calls)
    return wrapper


class TestQuotaMixin(object):
Beispiel #4
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from functools import partial

from pithos.backends.base import NotAllowedError
from pithos.backends.random_word import get_random_word

import uuid as uuidlib

serial = 0

get_random_data = lambda length: get_random_word(length)[:length]
get_random_name = partial(get_random_word, length=8)


class TestUUIDMixin(object):
    def test_get_object_by_uuid(self):
        container = get_random_name()
        obj = get_random_name()
        t = self.account, self.account, container, obj
        self.b.put_container(*t[:-1])

        permissions = {'read': ['somebody']}
        self.upload_object(*t, permissions=permissions)
        self.b.update_object_meta(*t, domain='test1', meta={'domain': 'test1'})
        meta = self.b.get_object_meta(*t, include_user_defined=False)
        v1 = meta['version']
Beispiel #5
0
def get_random_data(length=None):
    length = length or random.randint(
        pithos_settings.BACKEND_BLOCK_SIZE,
        2 * pithos_settings.BACKEND_BLOCK_SIZE)
    return get_random_word(length)[:length]