Exemplo n.º 1
0
    def test_set_object_name_component_length(self):
        len = cnt.get_object_name_component_length()
        cnt.set_object_name_component_length(len+1)
        self.assertEqual(len, cnt.get_object_name_component_length()-1)

        if hasattr(swift.common.constraints, 'constraints_conf_int'):
            len = swift.common.constraints.constraints_conf_int(
                'max_object_name_component_length', 255)
            cnt.set_object_name_component_length()
            self.assertEqual(len, cnt.get_object_name_component_length())

        with patch('swift.common.constraints.constraints_conf_int',
                   mock_constraints_conf_int):
            cnt.set_object_name_component_length()
            self.assertEqual(cnt.get_object_name_component_length(), 1000)
Exemplo n.º 2
0
    def test_set_object_name_component_length(self):
        len = cnt.get_object_name_component_length()
        cnt.set_object_name_component_length(len + 1)
        self.assertEqual(len, cnt.get_object_name_component_length() - 1)

        if hasattr(swift.common.constraints, 'constraints_conf_int'):
            len = swift.common.constraints.constraints_conf_int(
                'max_object_name_component_length', 255)
            cnt.set_object_name_component_length()
            self.assertEqual(len, cnt.get_object_name_component_length())

            with patch('swift.common.constraints.constraints_conf_int',
                       mock_constraints_conf_int):
                cnt.set_object_name_component_length()
                self.assertEqual(cnt.get_object_name_component_length(), 1000)
Exemplo n.º 3
0
 def test_validate_obj_name_component(self):
     max_obj_len = cnt.get_object_name_component_length()
     self.assertFalse(cnt.validate_obj_name_component('tests'*(max_obj_len/5)))
     cnt.set_object_name_component_length(300)
     self.assertFalse(cnt.validate_obj_name_component('tests'*60))
Exemplo n.º 4
0
 def tearDown(self):
     cnt.set_object_name_component_length()
Exemplo n.º 5
0
 def test_validate_obj_name_component(self):
     max_obj_len = cnt.get_object_name_component_length()
     self.assertFalse(
         cnt.validate_obj_name_component('tests' * (max_obj_len / 5)))
     cnt.set_object_name_component_length(300)
     self.assertFalse(cnt.validate_obj_name_component('tests' * 60))
Exemplo n.º 6
0
 def tearDown(self):
     cnt.set_object_name_component_length()