示例#1
0
    def test_the_tipping_point(self):
        thugga = self._create_user("youngthug")
        bbot = self._create_user("beginbot")
        monster = self._create_user("beginbotsmonster")
        assert User.count() == 3

        threshold = int(User.count() / 2)
        assert not Vote.have_tables_turned(threshold)
        Vote(user=thugga.name).vote("revolution")
        assert Vote.have_tables_turned(threshold) == "revolution"
        Vote(user=monster.name).vote("peace")
        assert not Vote.have_tables_turned(threshold)
        Vote(user=bbot.name).vote("peace")
        assert Vote.have_tables_turned(threshold) == "peace"
示例#2
0
 def test_commands(self):
     subject = User("artmattdank")
     assert User.count() == 1
     assert subject.commands() == []
     command = Command("flacid")
     command.allow_user("artmattdank")
     assert command.users() == ["artmattdank"]
     assert subject.commands() == ["flacid"]