Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 9b3c202
_commit: 19e0124
_src_path: https://github.com/python-project-templates/base.git
add_docs: false
add_extension: python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
files: '**/junit.xml'

- name: Upload coverage
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand Down
75 changes: 39 additions & 36 deletions csp_bot_commands/tests/test_fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def test_statics(self):
],
)
def test_execute(self, args):
if isinstance(args, str):
args = (args,)
msg = cmd.execute(
BotCommand(
backend="slack",
Expand All @@ -71,78 +73,79 @@ def test_execute(self, args):
assert msg is not None
assert msg.backend == "slack"
assert msg.channel == "test_channel"
msg_text = msg.msg.replace("<@", "@").replace(">", "")

if args[0] == "icelandic":
assert msg.msg.startswith("<@123> consoles <@456> with an Icelandic folk saying:")
assert msg_text.startswith("@123 consoles @456 with an Icelandic folk saying:")
elif args[0] == "german":
assert msg.msg.startswith("<@123> teaches <@456> some German:")
assert msg_text.startswith("@123 teaches @456 some German:")
elif args[0] == "cocktail":
assert msg.msg.startswith("<@123> calls <@456> over to the")
assert msg_text.startswith("@123 calls @456 over to the")
elif args[0] == "beer":
assert msg.msg.startswith("<@123> calls <@456> over to the")
assert msg_text.startswith("@123 calls @456 over to the")
elif args[0] == "dune":
assert msg.msg.startswith("<@123> scrapes wisdom for <@456> off the sands of Arrakis:")
assert msg_text.startswith("@123 scrapes wisdom for @456 off the sands of Arrakis:")
elif args[0] == "bush":
assert msg.msg.startswith("<@123> impresses <@456> with a quote from George W. Bush:")
assert msg_text.startswith("@123 impresses @456 with a quote from George W. Bush:")
elif args[0] == "shakespeare":
assert msg.msg.startswith("<@123> hurls a Shakespearean insult at <@456>:")
assert msg_text.startswith("@123 hurls a Shakespearean insult at @456:")
elif args[0] == "yogi":
assert msg.msg.startswith("<@123> shares some Yogi Berra wisdom with <@456>:")
assert msg_text.startswith("@123 shares some Yogi Berra wisdom with @456:")
elif args[0] == "tolkien":
assert msg.msg.startswith("<@123> offers <@456> wisdom from Middle-earth:")
assert msg_text.startswith("@123 offers @456 wisdom from Middle-earth:")
elif args[0] == "fortune":
assert msg.msg.startswith("<@123> cracks open a fortune cookie for <@456>:")
assert msg_text.startswith("@123 cracks open a fortune cookie for @456:")
elif args[0] == "pratchett":
assert msg.msg.startswith("<@123> enlightens <@456> with Pratchett:")
assert msg_text.startswith("@123 enlightens @456 with Pratchett:")
elif args[0] == "wilde":
assert msg.msg.startswith("<@123> graces <@456> with an Oscar Wilde quip:")
assert msg_text.startswith("@123 graces @456 with an Oscar Wilde quip:")
elif args[0] == "wine":
assert msg.msg.startswith("<@123> calls <@456> over to the")
assert msg_text.startswith("@123 calls @456 over to the")
elif args[0] == "nietzsche":
assert msg.msg.startswith("<@123> darkly enlightens <@456> with Nietzsche:")
assert msg_text.startswith("@123 darkly enlightens @456 with Nietzsche:")
elif args[0] == "twain":
assert msg.msg.startswith("<@123> shares a Mark Twain quip with <@456>:")
assert msg_text.startswith("@123 shares a Mark Twain quip with @456:")
elif args[0] == "zen":
assert msg.msg.startswith("<@123> offers <@456> a moment of zen:")
assert msg_text.startswith("@123 offers @456 a moment of zen:")
elif args[0] == "stoic":
assert msg.msg.startswith("<@123> offers <@456> some Stoic counsel:")
assert msg_text.startswith("@123 offers @456 some Stoic counsel:")
elif args[0] == "churchill":
assert msg.msg.startswith("<@123> channels Churchill for <@456>:")
assert msg_text.startswith("@123 channels Churchill for @456:")
elif args[0] == "confucius":
assert msg.msg.startswith("<@123> shares ancient wisdom with <@456>:")
assert msg_text.startswith("@123 shares ancient wisdom with @456:")
elif args[0] == "starwars":
assert msg.msg.startswith("<@123> reaches for the Force on behalf of <@456>:")
assert msg_text.startswith("@123 reaches for the Force on behalf of @456:")
elif args[0] == "hitch":
assert msg.msg.startswith("<@123> consults the Guide for <@456>:")
assert msg_text.startswith("@123 consults the Guide for @456:")
elif args[0] == "hemingway":
assert msg.msg.startswith("<@123> pours a drink and quotes Hemingway for <@456>:")
assert msg_text.startswith("@123 pours a drink and quotes Hemingway for @456:")
elif args[0] == "dad":
assert msg.msg.startswith("<@123> subjects <@456> to a dad joke:")
assert msg_text.startswith("@123 subjects @456 to a dad joke:")
elif args[0] == "chuck":
assert msg.msg.startswith("<@123> informs <@456> of a Chuck Norris fact:")
assert msg_text.startswith("@123 informs @456 of a Chuck Norris fact:")
elif args[0] == "soviet":
assert msg.msg.startswith("<@123> reminds <@456>:")
assert msg_text.startswith("@123 reminds @456:")
elif args[0] == "conspiracy":
assert msg.msg.startswith("<@123> whispers to <@456>:")
assert msg_text.startswith("@123 whispers to @456:")
elif args[0] == "magic8":
assert msg.msg.startswith("<@123> shakes the Magic 8-Ball for <@456>:")
assert msg_text.startswith("@123 shakes the Magic 8-Ball for @456:")
elif args[0] == "compliment":
assert msg.msg.startswith("<@123> lavishes praise on <@456>:")
assert msg_text.startswith("@123 lavishes praise on @456:")
elif args[0] == "latin":
assert msg.msg.startswith("<@123> schools <@456> in Latin:")
assert msg_text.startswith("@123 schools @456 in Latin:")
elif args[0] == "pirate":
assert msg.msg.startswith("<@123> makes <@456> walk the plank:")
assert msg_text.startswith("@123 makes @456 walk the plank:")
elif args[0] == "corporate":
assert msg.msg.startswith("<@123> synergizes with <@456>:")
assert msg_text.startswith("@123 synergizes with @456:")
elif args[0] == "motivational":
assert msg.msg.startswith("<@123> puts a poster on <@456>")
assert msg_text.startswith("@123 puts a poster on @456")
elif args[0] == "haiku":
assert msg.msg.startswith("<@123> composes a haiku for <@456>:")
assert msg_text.startswith("@123 composes a haiku for @456:")
elif args[0] == "programming":
assert msg.msg.startswith("<@123> shares a programming joke with <@456>:")
assert msg_text.startswith("@123 shares a programming joke with @456:")
elif args[0] == "whiskey":
assert msg.msg.startswith("<@123> calls <@456> over to the")
assert msg_text.startswith("@123 calls @456 over to the")
elif args[0] == "highfive":
assert msg.msg.startswith("<@123> gives <@456> a magnificent")
assert msg_text.startswith("@123 gives @456 a magnificent")
else:
assert False
5 changes: 4 additions & 1 deletion csp_bot_commands/tests/test_thanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def test_statics(self):
],
)
def test_execute(self, args):
if isinstance(args, str):
args = (args,)
msg = cmd.execute(
BotCommand(
backend="slack",
Expand All @@ -35,4 +37,5 @@ def test_execute(self, args):
assert msg is not None
assert msg.backend == "slack"
assert msg.channel == "test_channel"
assert msg.msg.startswith("<@123> thanks <@456> with")
msg_text = msg.msg.replace("<@", "@").replace(">", "")
assert msg_text.startswith("@123 thanks @456 with")
5 changes: 4 additions & 1 deletion csp_bot_commands/tests/test_trout.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def test_statics(self):
],
)
def test_execute(self, args):
if isinstance(args, str):
args = (args,)
msg = cmd.execute(
BotCommand(
backend="slack",
Expand All @@ -35,6 +37,7 @@ def test_execute(self, args):
assert msg is not None
assert msg.backend == "slack"
assert msg.channel == "test_channel"
assert msg.msg.startswith("<@123> slaps <@456> with")
msg_text = msg.msg.replace("<@", "@").replace(">", "")
assert msg_text.startswith("@123 slaps @456 with")
if args[0] == "trout":
assert "trout" in msg.msg
Loading