Additional snipe tests

pull/80/head
Stijn De Clercq 2021-07-01 01:16:52 +02:00
parent ab6819d963
commit 02bd10adcb
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
from data.snipe import should_snipe
import unittest
from unittest.mock import Mock
class TestSnipe(unittest.TestCase):
def test_should_snipe(self):
mock_message = Mock()
mock_guild = Mock()
mock_author = Mock()
# Guild is None
mock_message.guild = None
self.assertFalse(should_snipe(mock_message))
mock_message.guild = mock_guild
# Author is a bot
mock_message.author = mock_author
mock_author.bot = True
self.assertFalse(should_snipe(mock_message))
mock_author.bot = False
mock_message.content = "Some string that contains A123B-CE68S-Z6B34 a Steam code"
self.assertFalse(should_snipe(mock_message))
mock_message.content = "Some string that does NOT contain a Steam code"
self.assertTrue(should_snipe(mock_message))