Skip to content

Commit

Permalink
Merge pull request #170 from moggers87/169-version-command
Browse files Browse the repository at this point in the history
Set package name and message string for version option
  • Loading branch information
moggers87 authored Aug 6, 2024
2 parents 762d72c + a984f30 commit 7aba78a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion salmon/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def inner(fn):


@click.group(epilog=copyright_notice)
@click.version_option()
@click.version_option(package_name="salmon-mail", message="%(version)s")
def main():
"""Python mail server"""
pass
Expand Down
8 changes: 7 additions & 1 deletion tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from click import testing

from salmon import queue, commands, encoding, mail, routing, utils
from salmon import queue, commands, encoding, mail, routing, utils, __version__ as salmon_version

from .setup_env import SalmonTestCase

Expand Down Expand Up @@ -108,6 +108,12 @@ def test_sendmail_command(self, client_mock):
runner.invoke(commands.main, ("sendmail", "--host", "127.0.0.1", "--port", "8899", "test@localhost"))
self.assertEqual(client_mock.return_value.sendmail.call_count, 1)

def test_version_option(self):
runner = CliRunner()
result = runner.invoke(commands.main, ("--version"))
self.assertEqual(result.exit_code, 0)
self.assertEqual(result.output, f"{salmon_version}\n")


class StartCommandTestCase(SalmonTestCase):
@patch('salmon.utils.daemonize')
Expand Down

0 comments on commit 7aba78a

Please sign in to comment.