class StatPluginTestCase(B3TestCase):

    def setUp(self):
        B3TestCase.setUp(self)

        with logging_disabled():
            admin_conf = CfgConfigParser()
            admin_plugin = AdminPlugin(self.console, admin_conf)
            admin_plugin.onLoadConfig()
            admin_plugin.onStartup()
            when(self.console).getPlugin('admin').thenReturn(admin_plugin)

        conf = CfgConfigParser()
        conf.loadFromString(dedent(r"""
            [commands]
            mapstats-stats: 0
            testscore-ts: 0
            topstats-top: 0
            topxp: 0

            [settings]
            startPoints: 100
            resetscore: no
            resetxp: no
            show_awards: no
            show_awards_xp: no
        """))
        self.p = StatsPlugin(self.console, conf)
        self.p.onLoadConfig()
        self.p.onStartup()

        self.joe = FakeClient(self.console, name="Joe", guid="joeguid", groupBits=1, team=TEAM_RED)
        self.mike = FakeClient(self.console, name="Mike", guid="mikeguid", groupBits=1, team=TEAM_RED)
        self.joe.connects(1)
        self.mike.connects(2)
Example #2
0
    def test_nominal(self):
        # GIVEN
        conf = CfgConfigParser()
        conf.loadFromString(
            dedent(r"""
            [commands]
            mapstats-stats: 2
            testscore-ts: 2
            topstats-top: 20
            topxp: 20

            [settings]
            startPoints: 150
            resetscore: yes
            resetxp: yes
            show_awards: yes
            show_awards_xp: yes
        """))
        self.p = StatsPlugin(self.console, conf)
        # WHEN
        self.p.onLoadConfig()
        # THEN
        self.assertEqual(2, self.p.mapstatslevel)
        self.assertEqual(2, self.p.testscorelevel)
        self.assertEqual(20, self.p.topstatslevel)
        self.assertEqual(20, self.p.topxplevel)
        self.assertEqual(150, self.p.startPoints)
        self.assertTrue(self.p.resetscore)
        self.assertTrue(self.p.resetxp)
        self.assertTrue(self.p.show_awards)
        self.assertTrue(self.p.show_awards_xp)
Example #3
0
class Test_config(B3TestCase):

    def test_empty(self):
        # GIVEN
        conf = CfgConfigParser()
        conf.loadFromString(dedent(r"""
        """))
        self.p = StatsPlugin(self.console, conf)
        # WHEN
        self.p.onLoadConfig()
        # THEN
        self.assertEqual(0, self.p.mapstatslevel)
        self.assertEqual(0, self.p.testscorelevel)
        self.assertEqual(2, self.p.topstatslevel)
        self.assertEqual(2, self.p.topxplevel)
        self.assertEqual(100, self.p.startPoints)
        self.assertFalse(self.p.resetscore)
        self.assertFalse(self.p.resetxp)
        self.assertFalse(self.p.show_awards)
        self.assertFalse(self.p.show_awards_xp)

    def test_nominal(self):
        # GIVEN
        conf = CfgConfigParser()
        conf.loadFromString(dedent(r"""
            [commands]
            mapstats-stats: 2
            testscore-ts: 2
            topstats-top: 20
            topxp: 20

            [settings]
            startPoints: 150
            resetscore: yes
            resetxp: yes
            show_awards: yes
            show_awards_xp: yes
        """))
        self.p = StatsPlugin(self.console, conf)
        # WHEN
        self.p.onLoadConfig()
        # THEN
        self.assertEqual(2, self.p.mapstatslevel)
        self.assertEqual(2, self.p.testscorelevel)
        self.assertEqual(20, self.p.topstatslevel)
        self.assertEqual(20, self.p.topxplevel)
        self.assertEqual(150, self.p.startPoints)
        self.assertTrue(self.p.resetscore)
        self.assertTrue(self.p.resetxp)
        self.assertTrue(self.p.show_awards)
        self.assertTrue(self.p.show_awards_xp)
Example #4
0
 def test_empty(self):
     # GIVEN
     conf = CfgConfigParser()
     conf.loadFromString(dedent(r"""
     """))
     self.p = StatsPlugin(self.console, conf)
     # WHEN
     self.p.onLoadConfig()
     # THEN
     self.assertEqual(0, self.p.mapstatslevel)
     self.assertEqual(0, self.p.testscorelevel)
     self.assertEqual(2, self.p.topstatslevel)
     self.assertEqual(2, self.p.topxplevel)
     self.assertEqual(100, self.p.startPoints)
     self.assertFalse(self.p.resetscore)
     self.assertFalse(self.p.resetxp)
     self.assertFalse(self.p.show_awards)
     self.assertFalse(self.p.show_awards_xp)
Example #5
0
class StatPluginTestCase(B3TestCase):
    def setUp(self):
        B3TestCase.setUp(self)

        with logging_disabled():
            admin_conf = CfgConfigParser()
            admin_plugin = AdminPlugin(self.console, admin_conf)
            admin_plugin.onLoadConfig()
            admin_plugin.onStartup()
            when(self.console).getPlugin('admin').thenReturn(admin_plugin)

        conf = CfgConfigParser()
        conf.loadFromString(
            dedent(r"""
            [commands]
            mapstats-stats: 0
            testscore-ts: 0
            topstats-top: 0
            topxp: 0

            [settings]
            startPoints: 100
            resetscore: no
            resetxp: no
            show_awards: no
            show_awards_xp: no
        """))
        self.p = StatsPlugin(self.console, conf)
        self.p.onLoadConfig()
        self.p.onStartup()

        self.joe = FakeClient(self.console,
                              name="Joe",
                              guid="joeguid",
                              groupBits=1,
                              team=TEAM_RED)
        self.mike = FakeClient(self.console,
                               name="Mike",
                               guid="mikeguid",
                               groupBits=1,
                               team=TEAM_RED)
        self.joe.connects(1)
        self.mike.connects(2)
Example #6
0
 def test_empty(self):
     # GIVEN
     conf = CfgConfigParser()
     conf.loadFromString(dedent(r"""
     """))
     self.p = StatsPlugin(self.console, conf)
     # WHEN
     self.p.onLoadConfig()
     # THEN
     self.assertEqual(0, self.p.mapstatslevel)
     self.assertEqual(0, self.p.testscorelevel)
     self.assertEqual(2, self.p.topstatslevel)
     self.assertEqual(2, self.p.topxplevel)
     self.assertEqual(100, self.p.startPoints)
     self.assertFalse(self.p.resetscore)
     self.assertFalse(self.p.resetxp)
     self.assertFalse(self.p.show_awards)
     self.assertFalse(self.p.show_awards_xp)