Previously the test-bots script filtered out base-class tests from BotTestCase. With this change, BotTestCase continues to inherit from unittest.TestCase, but the default test_* methods previously in this class are now in a new DefaultTests class, which does not. Instead, each bot needs to inherit from BotTestCase and DefaultTests *explicitly*. This avoids the need to filter out the base-class tests, which simplifies the test-bots script, and may ease any migration to eg. pytest. The DefaultTests class does require some non-implemented methods which BotTestCase provides.
14 lines
584 B
Python
Executable file
14 lines
584 B
Python
Executable file
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
|
|
|
class TestEncryptBot(BotTestCase, DefaultTests):
|
|
bot_name = "encrypt"
|
|
|
|
def test_bot(self) -> None:
|
|
dialog = [
|
|
("", "Encrypted/Decrypted text: "),
|
|
("Let\'s Do It", "Encrypted/Decrypted text: Yrg\'f Qb Vg"),
|
|
("me&mom together..!!", "Encrypted/Decrypted text: zr&zbz gbtrgure..!!"),
|
|
("foo bar", "Encrypted/Decrypted text: sbb one"),
|
|
("Please encrypt this", "Encrypted/Decrypted text: Cyrnfr rapelcg guvf"),
|
|
]
|
|
self.verify_dialog(dialog)
|