contrib_bots: Add check_expected_responses() test helper and use it.
This further simplifies the logic for testing a contrib_bots bot to require very little code per test in the common case.
This commit is contained in:
parent
536ab436ed
commit
1991e0128b
8 changed files with 63 additions and 97 deletions
|
@ -16,14 +16,12 @@ class TestDefineBot(BotTestCase):
|
|||
bot_name = "define"
|
||||
|
||||
def test_bot(self):
|
||||
self.assert_bot_output(
|
||||
{'content': "foo", 'type': "private", 'sender_email': "foo"},
|
||||
"**foo**:\nDefinition not available."
|
||||
)
|
||||
self.assert_bot_output(
|
||||
{'content': "cat", 'type': "stream", 'display_recipient': "foo", 'subject': "foo"},
|
||||
("**cat**:\n\n* (**noun**) a small domesticated carnivorous mammal "
|
||||
"with soft fur, a short snout, and retractile claws. It is widely "
|
||||
"kept as a pet or for catching mice, and many breeds have been "
|
||||
"developed.\n their pet cat\n\n"),
|
||||
)
|
||||
expected = {
|
||||
"": 'Please enter a word to define.',
|
||||
"foo": "**foo**:\nDefinition not available.",
|
||||
"cat": ("**cat**:\n\n* (**noun**) a small domesticated carnivorous mammal "
|
||||
"with soft fur, a short snout, and retractile claws. It is widely "
|
||||
"kept as a pet or for catching mice, and many breeds have been "
|
||||
"developed.\n their pet cat\n\n"),
|
||||
}
|
||||
self.check_expected_responses(expected)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue