Пример #1
0
 def __instancecheck__(cls, instance):
     try:
         int(instance)
     except (ValueError, TypeError):
         return (isinstance(instance, six.string_types)
                 and uuidutils.is_uuid_like(instance))
     return (isinstance(instance, six.integer_types + six.string_types)
             and type(instance) != bool)
Пример #2
0
def validate_job_location_format(entry):
    if entry.startswith('savanna-db://'):
        return uuidutils.is_uuid_like(entry[len("savanna-db://"):])
    if entry.startswith(su.SWIFT_INTERNAL_PREFIX):
        #TODO(tmckay):allow su.SWIFT_EXTERNAL_PREFIX in a future version
        #TODO(nprivalova):add hostname validation
        return True
    return False
Пример #3
0
 def __instancecheck__(cls, instance):
     try:
         int(instance)
     except (ValueError, TypeError):
         return (isinstance(instance, six.string_types)
                 and uuidutils.is_uuid_like(instance))
     return (isinstance(instance, six.integer_types + six.string_types)
             and type(instance) != bool)
Пример #4
0
def validate_job_location_format(entry):
    if entry.startswith('savanna-db://'):
        return uuidutils.is_uuid_like(entry[len("savanna-db://"):])
    if (entry.startswith('swift-internal://') or
            entry.startswith('swift-external://')):
        #TODO(nprivalova):add hostname validation
        return True
    return False
Пример #5
0
def validate_job_location_format(entry):
    if entry.startswith('savanna-db://'):
        return uuidutils.is_uuid_like(entry[len("savanna-db://"):])

    # TODO(mattf): remove support for OLD_SWIFT_INTERNAL_PREFIX
    if entry.startswith(su.SWIFT_INTERNAL_PREFIX) or (entry.startswith(
            su.OLD_SWIFT_INTERNAL_PREFIX)):
        #TODO(nprivalova):add hostname validation
        return True
    return False
Пример #6
0
    def assertIsValidModelObject(self, res):
        self.assertIsNotNone(res)
        self.assertIsNotNone(res.dict)
        self.assertTrue(uuidutils.is_uuid_like(res.id))

        # check created/updated
        delta = datetime.timedelta(seconds=15)
        now = timeutils.utcnow()

        self.assertAlmostEqual(res.created, now, delta=delta)
        self.assertAlmostEqual(res.updated, now, delta=delta)
Пример #7
0
    def assertIsValidModelObject(self, res):
        self.assertIsNotNone(res)
        self.assertIsNotNone(res.dict)
        self.assertTrue(uuidutils.is_uuid_like(res.id))

        # check created/updated
        delta = datetime.timedelta(seconds=15)
        now = timeutils.utcnow()

        self.assertAlmostEqual(res.created, now, delta=delta)
        self.assertAlmostEqual(res.updated, now, delta=delta)
Пример #8
0
def validate_uuid_format(entry):
    return uuidutils.is_uuid_like(entry)
Пример #9
0
def validate_uuid_format(entry):
    return uuidutils.is_uuid_like(entry)