예제 #1
0
 def testValidateNamespace(self):
   self.assertIsNone(utils.validate_namespace('a'))
   self.assertIsNone(utils.validate_namespace('a-a'))
   self.assertIsNone(utils.validate_namespace('a123'))
   self.assertIsNone(utils.validate_namespace('123'))
   self.assertIsNone(utils.validate_namespace('1.2'))
   self.assertIsNone(utils.validate_namespace('a' * 99))
   self.assertIsNone(utils.validate_namespace(None))
   invalid_namespaces = [
       '',
       'a ',
       '/',
       '/a',
       'a/a',
       'a/',
       u'∆',
       'a\na',
       'a' * 250,
       ['a'],
   ]
   for namespace in invalid_namespaces:
     try:
       utils.validate_namespace(namespace)
     except ValueError:
       pass
     else:
       self.fail(
           'Invalid namespace should have failed: {!r}'.format(namespace))
예제 #2
0
 def testValidateNamespace(self):
     self.assertIsNone(utils.validate_namespace('a'))
     self.assertIsNone(utils.validate_namespace('a-a'))
     self.assertIsNone(utils.validate_namespace('a123'))
     self.assertIsNone(utils.validate_namespace('123'))
     self.assertIsNone(utils.validate_namespace('1.2'))
     self.assertIsNone(utils.validate_namespace('a' * 99))
     self.assertIsNone(utils.validate_namespace(None))
     invalid_namespaces = [
         '',
         'a ',
         '/',
         '/a',
         'a/a',
         'a/',
         u'∆',
         'a\na',
         'a' * 250,
         ['a'],
     ]
     for namespace in invalid_namespaces:
         try:
             utils.validate_namespace(namespace)
         except ValueError:
             pass
         else:
             self.fail('Invalid namespace should have failed: {!r}'.format(
                 namespace))
예제 #3
0
 def validate_path(path, namespace=None):
   utils.validate_dir_path(path)
   if namespace is not None:
     utils.validate_namespace(namespace)
예제 #4
0
파일: dirs.py 프로젝트: dindinet/titan
 def validate_path(path, namespace=None):
     utils.validate_dir_path(path)
     if namespace is not None:
         utils.validate_namespace(namespace)