def setUp(self): super(mixin_conf, self).setUp() self.conf = CfgConfigParser() self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() logger = logging.getLogger('output') logger.setLevel(logging.INFO)
def setUp(self): super(Test_cmd_ident, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] paident-id: 20 [special] paident_full_level: 40 """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.parser_conf._settings.update( {'b3': { "time_zone": "GMT", "time_format": "%I:%M%p %Z %m/%d/%y" }}) self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock() self.moderator.connects("2") self.moderator.message_history = []
def setUp(self): super(Test_cmd_pagear, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] pagear-gear: 20 """) self.p = PoweradminurtPlugin(self.console, self.conf) when(self.console).getCvar('timelimit').thenReturn(Cvar('timelimit', value=20)) when(self.console).getCvar('g_maxGameClients').thenReturn(Cvar('g_maxGameClients', value=16)) when(self.console).getCvar('sv_maxclients').thenReturn(Cvar('sv_maxclients', value=16)) when(self.console).getCvar('sv_privateClients').thenReturn(Cvar('sv_privateClients', value=0)) when(self.console).getCvar('g_allowvote').thenReturn(Cvar('g_allowvote', value=0)) when(self.console).getCvar('g_modversion').thenReturn(Cvar('g_modversion', value="4.1")) self.given_forbidden_weapon_are(G_NONE) self.p.onLoadConfig() self.p.onStartup() self.sleep_patcher = patch.object(time, 'sleep') self.sleep_patcher.start() self.setCvar_patcher = patch.object(self.console, 'setCvar') self.setCvar_mock = self.setCvar_patcher.start() self.superadmin.connects("2")
def setUp(self): super(Test_headshotcounter, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [headshotcounter] # enable the headshot counter? hs_enable: True # reset counts? Options: no / map / round reset_vars: no # set broadcast to True if you want the counter to appear in the upper left, False is in chatarea broadcast: True # Announce every single headshot? announce_all: True # Announce percentages (after 5 headshots) announce_percentages: True # Only show percentages larger than next threshold percent_min: 10 # Advise victims to wear a helmet? warn_helmet: True # After how many headshots? warn_helmet_nr: 7 # Advise victims to wear kevlar? warn_kevlar: True # After how many torso hits? warn_kevlar_nr: 50 """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock()
def setUp(self): super(Test_cmd_captain, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] pacaptain-captain: 40 ; set the the given client as the captain for its team """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock() self.admin.connects("2") self.moderator.connects("3")
def setUp(self): super(Test_cmd_swap, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] paswap-swap: 20 """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock() self.admin.connects("2") self.moderator.connects("3")
def setUp(self): super(Test_cmd_skins, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] pagoto-goto: 20 ; set the goto <on/off> """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock() self.moderator.connects("2")
def setUp(self): super(Test_cmd_funstuff, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] pastamina-stamina: 20 ; set the stamina behavior <default/regain/infinite> """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock() self.moderator.connects("2")
def setUp(self): super(Test_cmd_gungame, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] pagungame-gungame: 20 ; change game type to Gun Game """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock() self.moderator.connects("2")
def setUp(self): super(mixin_cmd_paset, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] paset: 20 """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.sleep_patcher = patch.object(time, 'sleep') self.sleep_patcher.start() self.setCvar_patcher = patch.object(self.console, 'setCvar') self.setCvar_mock = self.setCvar_patcher.start() self.moderator.connects("2")
def setUp(self): super(mixin_cmd_nuke, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [commands] panuke-nuke: 20 """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.sleep_patcher = patch.object(time, 'sleep') self.sleep_patcher.start() self.console.say = Mock() self.console.saybig = Mock() self.console.write = Mock() self.moderator.connects("2")
def setUp(self): super(mixin_name_checker, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString(""" [namechecker] checkdupes: True checkunknown: True checkbadnames: True """) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.sleep_patcher = patch.object(time, 'sleep') self.sleep_patcher.start() self.console.say = Mock() self.console.write = Mock() self.p._ignoreTill = 0
def setUp(self): super(Test_cmd_teams, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString( dedent(""" [commands] pateams-teams: 1 [teambalancer] tinterval: 0 teamdifference: 1 maxlevel: 60 announce: 2 team_change_force_balance_enable: True autobalance_gametypes: tdm,ctf,cah,ftl,ts,bm,freeze teamLocksPermanent: False timedelay: 60 """)) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock() with logging_disabled(): from b3.fake import FakeClient self.blue1 = FakeClient(self.console, name="Blue1", guid="zaerezarezar", groupBits=1, team=TEAM_BLUE) self.blue2 = FakeClient(self.console, name="Blue2", guid="qsdfdsqfdsqf", groupBits=1, team=TEAM_BLUE) self.blue3 = FakeClient(self.console, name="Blue3", guid="qsdfdsqfdsqf33", groupBits=1, team=TEAM_BLUE) self.blue4 = FakeClient(self.console, name="Blue4", guid="sdf455ezr", groupBits=1, team=TEAM_BLUE) self.red1 = FakeClient(self.console, name="Red1", guid="875sasda", groupBits=1, team=TEAM_RED) self.red2 = FakeClient(self.console, name="Red2", guid="f4qfer654r", groupBits=1, team=TEAM_RED) # connect clients self.blue1.connects('1') self.blue2.connects('2') self.blue3.connects('3') self.blue4.connects('4') self.red1.connects('5') self.red2.connects('6') self.p.countteams = Mock(return_value=True) self.p._teamred = 2 self.p._teamblue = 4
def setUp(self): super(Test_radio_spam_protection, self).setUp() self.conf = CfgConfigParser() self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar()
def setUp(self): super(Test_cmd_balance, self).setUp() self.conf = CfgConfigParser() self.conf.loadFromString( dedent(""" [commands] pabalance-balance: 1 [skillbalancer] min_bal_interval: 1 interval: 0 difference: 0.5 mode: 2 """)) self.p = PoweradminurtPlugin(self.console, self.conf) self.init_default_cvar() self.p.onLoadConfig() self.p.onStartup() self.console.say = Mock() self.console.write = Mock() with logging_disabled(): from b3.fake import FakeClient self.blue1 = FakeClient(self.console, name="Blue1", guid="zaerezarezar", groupBits=1, team=TEAM_BLUE) self.blue2 = FakeClient(self.console, name="Blue2", guid="qsdfdsqfdsqf", groupBits=1, team=TEAM_BLUE) self.blue3 = FakeClient(self.console, name="Blue3", guid="qsdfdsqfdsqf33", groupBits=1, team=TEAM_BLUE) self.blue4 = FakeClient(self.console, name="Blue4", guid="sdf455ezr", groupBits=1, team=TEAM_BLUE) self.red1 = FakeClient(self.console, name="Red1", guid="875sasda", groupBits=1, team=TEAM_RED) self.red2 = FakeClient(self.console, name="Red2", guid="f4qfer654r", groupBits=1, team=TEAM_RED) # connect clients self.blue1.connects('1') self.blue2.connects('2') self.blue3.connects('3') self.blue4.connects('4') self.red1.connects('5') self.red2.connects('6') self.p.countteams = Mock(return_value=True) self.p._teamred = 2 self.p._teamblue = 4