當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。