コード例 #1
0
 def test_a_give_random_command(self):
     user = "******"
     args = ["@artmattDank", "random"]
     subject = CommandParser(user, "give", args, allow_random_sfx=True)
     result = subject.parse()
     assert result.target_user == "artmattdank"
     assert result.target_command == "give"
     assert result.target_sfx == "random"
     assert result.requester == user
コード例 #2
0
 def test_just_a_user(self):
     user = "******"
     args = ["@artmattDank"]
     subject = CommandParser(user, "perms", args)
     result = subject.parse()
     assert result.target_user == "artmattdank"
     assert result.target_command == "perms"
     assert result.target_sfx == None
     assert result.requester == user
コード例 #3
0
 def test_a_buy_random_command_when_not_allowed(self):
     user = "******"
     args = ["random"]
     subject = CommandParser(user, "buy", args, allow_random_sfx=False)
     result = subject.parse()
     assert result.target_user == None
     assert result.target_command == "buy"
     assert result.target_sfx == None
     assert result.requester == user
コード例 #4
0
 def test_just_a_command(self):
     user = "******"
     args = ["!clap"]
     subject = CommandParser(user, "perms", args)
     result = subject.parse()
     assert result.target_user == None
     assert result.target_command == "perms"
     assert result.target_sfx == "clap"
     assert result.requester == user
コード例 #5
0
    def test_the_1080(self):
        user = "******"
        args = ["1080"]
        subject = CommandParser(user, "dropeffect", args)
        result = subject.parse()

        assert result.target_command == "dropeffect"
        assert result.target_sfx == "1080"
        assert result.amount == 1
コード例 #6
0
 def test_transfer(self):
     user = "******"
     args = ["@artmattdank", "!clap"]
     subject = CommandParser(user, "transfer", args)
     result = subject.parse()
     assert result.target_user == "artmattdank"
     assert result.target_command == "transfer"
     assert result.target_sfx == "clap"
     assert result.requester == user
コード例 #7
0
    def test_amount_with_seconds(self):
        user = "******"
        args = ["beginbot", "10s"]
        subject = CommandParser(user, "props", args)
        result = subject.parse()

        assert result.target_command == "props"
        assert result.target_user == "beginbot"
        assert result.target_sfx == None
        assert result.amount == 10
コード例 #8
0
 def test_transfer_to_random_user_when_not_allowed(self):
     user = "******"
     args = ["random", "random"]
     subject = CommandParser(
         user, "transfer", args, allow_random_sfx=True, allow_random_user=False
     )
     result = subject.parse()
     assert result.target_user == None
     assert result.target_command == "transfer"
     assert result.target_sfx == "random"
     assert result.requester == user
コード例 #9
0
 def test_transfer_to_random_user(self):
     user = "******"
     args = ["random", "random"]
     subject = CommandParser(
         user, "transfer", args, allow_random_sfx=True, allow_random_user=True
     )
     result = subject.parse()
     assert result.target_user == "random"
     assert result.target_command == "transfer"
     assert result.target_sfx == "random"
     assert result.requester == user
コード例 #10
0
    def test_blank_means_random(self):
        user = "******"
        args = []
        subject = CommandParser(
            user, "steal", args, allow_random_sfx=True, allow_random_user=True
        )
        result = subject.parse()

        assert result.target_command == "steal"
        assert result.target_user == "random"
        assert result.target_sfx == "random"
        assert result.requester == user