mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Additional snipe tests
This commit is contained in:
parent
ab6819d963
commit
02bd10adcb
1 changed files with 27 additions and 0 deletions
27
tests/test_data/test_snipe.py
Normal file
27
tests/test_data/test_snipe.py
Normal 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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue