-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# pylint: disable=unsubscriptable-object, unsupported-membership-test | ||
import pytest | ||
from ...gramhopper.triggers.text_triggers import _RegExpTrigger, \ | ||
_HasSubstringTrigger, _HasExactWordTrigger | ||
|
@@ -14,6 +15,8 @@ def test_message_matches(self, update): | |
update.message.text = '[email protected]' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 3 | ||
|
@@ -42,6 +45,8 @@ def test_single_substring_exact_matches(self, update): | |
update.message.text = 'ello' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -61,6 +66,8 @@ def test_single_substring_not_exact_matches(self, update): | |
update.message.text = 'ello' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -69,6 +76,8 @@ def test_single_substring_not_exact_matches(self, update): | |
update.message.text = 'yellow' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -88,6 +97,8 @@ def test_multiple_substrings_exact_matches(self, update): | |
update.message.text = 'yellow' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -96,6 +107,8 @@ def test_multiple_substrings_exact_matches(self, update): | |
update.message.text = 'ello' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -115,6 +128,8 @@ def test_multiple_substrings_not_exact_matches(self, update): | |
update.message.text = 'yellow' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -123,6 +138,8 @@ def test_multiple_substrings_not_exact_matches(self, update): | |
update.message.text = 'fellow' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -149,6 +166,8 @@ def test_single_substring_exact_matches(self, update): | |
update.message.text = 'ello' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -168,6 +187,8 @@ def test_multiple_substrings_exact_matches(self, update): | |
update.message.text = 'yellow' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|
@@ -176,6 +197,8 @@ def test_multiple_substrings_exact_matches(self, update): | |
update.message.text = 'fellow' | ||
result = trigger.check_trigger(update) | ||
assert result.should_respond | ||
assert result.response_payload | ||
assert isinstance(result.response_payload, dict) | ||
assert 'match' in result.response_payload | ||
match = result.response_payload['match'] | ||
assert len(match) == 1 | ||
|