Пример #1
0
 def test_validate_obj_name_component_err(self):
     max_obj_len = cnt.SOF_MAX_OBJECT_NAME_LENGTH
     self.assertTrue(
         cnt.validate_obj_name_component('tests' * (max_obj_len / 5 + 1)))
     self.assertTrue(cnt.validate_obj_name_component('.'))
     self.assertTrue(cnt.validate_obj_name_component('..'))
     self.assertTrue(cnt.validate_obj_name_component(''))
Пример #2
0
    def test_validate_obj_name_component(self):
        req = Mock()

        # Non-last object name component - success
        for i in (220, 221, 222, 254, 255):
            obj_comp_name = "a" * i
            self.assertFalse(cnt.validate_obj_name_component(obj_comp_name, req))

        # Last object name component - success
        for i in (220, 221):
            obj_comp_name = "a" * i
            self.assertFalse(cnt.validate_obj_name_component(obj_comp_name, req, True))
Пример #3
0
    def test_validate_obj_name_component(self):
        req = Mock()

        # Non-last object name component - success
        for i in (220, 221, 222, 254, 255):
            obj_comp_name = 'a' * i
            self.assertFalse(
                cnt.validate_obj_name_component(obj_comp_name, req))

        # Last object name component - success
        for i in (220, 221):
            obj_comp_name = 'a' * i
            self.assertFalse(
                cnt.validate_obj_name_component(obj_comp_name, req, True))
Пример #4
0
    def test_validate_obj_name_component_err(self):
        req = Mock()

        # Non-last object name component - err
        for i in (256, 257):
            obj_comp_name = 'a' * i
            result = cnt.validate_obj_name_component(obj_comp_name, req)
            self.assertTrue(("too long (%d)" % i) in result)

        # Last object name component - err
        for i in (222, 223):
            obj_comp_name = 'a' * i
            result = cnt.validate_obj_name_component(obj_comp_name, req, True)
            self.assertTrue(("too long (%d)" % i) in result)

        self.assertTrue(cnt.validate_obj_name_component('.', req))
        self.assertTrue(cnt.validate_obj_name_component('..', req))
        self.assertTrue(cnt.validate_obj_name_component('', req))
Пример #5
0
    def test_validate_obj_name_component_err(self):
        req = Mock()

        # Non-last object name component - err
        for i in (256, 257):
            obj_comp_name = "a" * i
            result = cnt.validate_obj_name_component(obj_comp_name, req)
            self.assertTrue(("too long (%d)" % i) in result)

        # Last object name component - err
        for i in (222, 223):
            obj_comp_name = "a" * i
            result = cnt.validate_obj_name_component(obj_comp_name, req, True)
            self.assertTrue(("too long (%d)" % i) in result)

        self.assertTrue(cnt.validate_obj_name_component(".", req))
        self.assertTrue(cnt.validate_obj_name_component("..", req))
        self.assertTrue(cnt.validate_obj_name_component("", req))
Пример #6
0
 def test_validate_obj_name_component_err(self):
     max_obj_len = cnt.SOF_MAX_OBJECT_NAME_LENGTH
     self.assertTrue(cnt.validate_obj_name_component("tests" * (max_obj_len / 5 + 1)))
     self.assertTrue(cnt.validate_obj_name_component("."))
     self.assertTrue(cnt.validate_obj_name_component(".."))
     self.assertTrue(cnt.validate_obj_name_component(""))
Пример #7
0
 def test_validate_obj_name_component(self):
     max_obj_len = cnt.SOF_MAX_OBJECT_NAME_LENGTH
     self.assertFalse(cnt.validate_obj_name_component("tests" * (max_obj_len / 5)))
     self.assertEqual(cnt.validate_obj_name_component("tests" * 60), "too long (300)")
Пример #8
0
 def test_validate_obj_name_component(self):
     max_obj_len = cnt.SOF_MAX_OBJECT_NAME_LENGTH
     self.assertFalse(
         cnt.validate_obj_name_component('tests' * (max_obj_len / 5)))
     self.assertEqual(cnt.validate_obj_name_component('tests' * 60),
                      'too long (300)')