当前位置: 首页>>代码示例>>Python>>正文


Python security.Condition类代码示例

本文整理汇总了Python中security.Condition的典型用法代码示例。如果您正苦于以下问题:Python Condition类的具体用法?Python Condition怎么用?Python Condition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Condition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_regex

 def test_regex(self):
     condition = Condition('name1', 'value1', False, False)
     self.assertFalse(condition.get_regex())
     condition.set_regex(True)
     self.assertTrue(condition.get_regex())
     condition.set_regex(None)
     self.assertEqual(None, condition.get_regex())
     condition = Condition(regex = True)
     self.assertTrue(condition.get_regex())
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:9,代码来源:security_test.py

示例2: test_name

 def test_name(self):
     condition = Condition('name1')
     self.assertEqual('name1', condition.get_name())
     condition.set_name('name2')
     self.assertEqual('name2', condition.get_name())
     condition.set_name(None)
     self.assertEqual(None, condition.get_name())
     condition = Condition(name = 'name1')
     self.assertEqual('name1', condition.get_name())
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:9,代码来源:security_test.py

示例3: test_value

 def test_value(self):
     condition = Condition('name1', 'value1')
     self.assertEqual('value1', condition.get_value())
     condition.set_value('value2')
     self.assertEqual('value2', condition.get_value())
     condition.set_value(None)
     self.assertEqual(None, condition.get_value())
     condition = Condition(value = 'value1')
     self.assertEqual('value1', condition.get_value())
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:9,代码来源:security_test.py

示例4: test_from_lxml_full

    def test_from_lxml_full(self):
        text = '''
<CONDITION name="name" value="value" not="yes" regex="yes">
  <PERMISSION />
  <RETURN />
</CONDITION>'''
        condition = Condition.from_lxml_element(etree.XML(text))
        right = Condition('name', 'value', True, True,
                          [Permission(), Return()])
        self.assertEqual(condition, right)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:10,代码来源:security_test.py

示例5: condition_test

    def condition_test(self):
        text = '''
<CONDITION custom="unknown">
  <PERMISSION />
  <UNKNOWN>
    <CUSTOM />
  </UNKNOWN>
</CONDITION>'''
        condition = Condition.from_string(text)
        tree = condition.to_lxml_element()
        self.assertEqual('unknown', tree.get('custom'))
        unknown = tree.findall('UNKNOWN')
        self.assertEqual(1, len(unknown))
        unknown = unknown[0]
        custom = list(unknown)
        self.assertEqual(1, len(custom))
        custom = custom[0]
        self.assertEqual('CUSTOM', custom.tag)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:18,代码来源:security_test.py

示例6: test_to_string_value

 def test_to_string_value(self):
     condition = Condition(value = 'value')
     copy = Condition.from_string(str(condition))
     self.assertEqual(condition, copy)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:4,代码来源:security_test.py

示例7: test_to_lxml_full

 def test_to_lxml_full(self):
     condition = Condition('name', 'value', True, True,
                           [Permission(), Return()])
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:5,代码来源:security_test.py

示例8: test_from_string_value

 def test_from_string_value(self):
     text = '<CONDITION value="test" />'
     condition = Condition.from_string(text)
     right = Condition(value = 'test')
     self.assertEqual(condition, right)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:5,代码来源:security_test.py

示例9: test_to_lxml_regex

 def test_to_lxml_regex(self):
     condition = Condition(regex = True)
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:4,代码来源:security_test.py

示例10: test_to_lxml_sub_elements

 def test_to_lxml_sub_elements(self):
     condition = Condition(sub_elements = [Permission(), Return()])
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:4,代码来源:security_test.py

示例11: test_to_lxml_name

 def test_to_lxml_name(self):
     condition = Condition(name = 'name')
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:4,代码来源:security_test.py

示例12: test_to_lxml_value

 def test_to_lxml_value(self):
     condition = Condition(value = 'value')
     copy = Condition.from_lxml_element(condition.to_lxml_element())
     self.assertEqual(condition, copy)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:4,代码来源:security_test.py

示例13: test_to_string_sub_elements

 def test_to_string_sub_elements(self):
     condition = Condition(sub_elements = [Permission(), Return()])
     copy = Condition.from_string(str(condition))
     self.assertEqual(condition, copy)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:4,代码来源:security_test.py

示例14: test_to_string_full

 def test_to_string_full(self):
     condition = Condition('name', 'value', True, True,
                           [Permission(), Return()])
     copy = Condition.from_string(str(condition))
     self.assertEqual(condition, copy)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:5,代码来源:security_test.py

示例15: test_from_string_regex

 def test_from_string_regex(self):
     text = '<CONDITION regex="yes" />'
     condition = Condition.from_string(text)
     right = Condition(regex = True)
     self.assertEqual(condition, right)
开发者ID:rupinder,项目名称:GNU-MyServer,代码行数:5,代码来源:security_test.py


注:本文中的security.Condition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。