Merge pull request #80 from stijndcl/extra_snipe_tests

Additional snipe tests
pull/86/head
Stijn De Clercq 2021-07-01 01:18:53 +02:00 committed by GitHub
commit b18c15a380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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))