本文整理汇总了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>""")