本文整理匯總了Python中b3.parsers.frostbite2.abstractParser.AbstractParser.load_conf_ban_agent方法的典型用法代碼示例。如果您正苦於以下問題:Python AbstractParser.load_conf_ban_agent方法的具體用法?Python AbstractParser.load_conf_ban_agent怎麽用?Python AbstractParser.load_conf_ban_agent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類b3.parsers.frostbite2.abstractParser.AbstractParser
的用法示例。
在下文中一共展示了AbstractParser.load_conf_ban_agent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Test_config_ban_agent
# 需要導入模塊: from b3.parsers.frostbite2.abstractParser import AbstractParser [as 別名]
# 或者: from b3.parsers.frostbite2.abstractParser.AbstractParser import load_conf_ban_agent [as 別名]
class Test_config_ban_agent(AbstractParser_TestCase):
def setUp(self):
self.conf = XmlConfigParser()
self.conf.loadFromString("""<configuration/>""")
self.parser = AbstractParser(self.conf)
log = logging.getLogger('output')
log.setLevel(logging.DEBUG)
def tearDown(self):
self.parser.working = False
def assert_both(self, config):
self.conf.loadFromString(config)
self.parser.load_conf_ban_agent()
self.assertNotEqual(None, self.parser.PunkBuster)
self.assertTrue(self.parser.ban_with_server)
def assert_punkbuster(self, config):
self.conf.loadFromString(config)
self.parser.load_conf_ban_agent()
self.assertNotEqual(None, self.parser.PunkBuster)
self.assertFalse(self.parser.ban_with_server)
def assert_frostbite(self, config):
self.conf.loadFromString(config)
self.parser.load_conf_ban_agent()
self.assertEqual(None, self.parser.PunkBuster)
self.assertTrue(self.parser.ban_with_server)
def test_both(self):
self.assert_both("""<configuration><settings name="server"><set name="ban_agent">both</set></settings></configuration>""")
self.assert_both("""<configuration><settings name="server"><set name="ban_agent">BOTH</set></settings></configuration>""")
def test_punkbuster(self):
self.assert_punkbuster("""<configuration><settings name="server"><set name="ban_agent">punkbuster</set></settings></configuration>""")
self.assert_punkbuster("""<configuration><settings name="server"><set name="ban_agent">PUNKBUSTER</set></settings></configuration>""")
def test_frostbite(self):
self.assert_frostbite("""<configuration><settings name="server"><set name="ban_agent">server</set></settings></configuration>""")
self.assert_frostbite("""<configuration><settings name="server"><set name="ban_agent">SERVER</set></settings></configuration>""")
def test_default(self):
self.assert_frostbite("""<configuration/>""")
self.assert_frostbite("""<configuration><settings name="server"><set name="ban_agent"></set></settings></configuration>""")
self.assert_frostbite("""<configuration><settings name="server"><set name="ban_agent"/></settings></configuration>""")