Skip to content

Commit

Permalink
bot: Added room parameter to run command (#17)
Browse files Browse the repository at this point in the history
* Added room parameter to run command

* Test adapted to the modified DubtrackBotBackend

* abot version required for mosbot upgraded
  • Loading branch information
jonbesga authored and dtgoitia committed Aug 9, 2018
1 parent 817eee7 commit 9628fa6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ click = "*"
aiopg = "*"
alembic = "*"
asyncio-extras = "*"
abot = "==0.0.1a1.dev16"
abot = "==0.0.1a1.post0.dev23"

[dev-packages]
pylint = "*"
Expand Down
6 changes: 3 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions mosbot/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ def test():

@botcli.command()
@click.option('--debug/--no-debug', '-d/ ', default=False)
def run(debug):
@click.option('--room', '-r', nargs=1, default='master-of-soundtrack')
def run(debug, room):
"""Run the bot, this is the main command that is usually run in the server"""
check_alembic_in_latest_version()
setup_logging(debug)
# Setup
bot = Bot()
dubtrack_backend = DubtrackBotBackend()
dubtrack_backend = DubtrackBotBackend(room=room)
dubtrack_backend.configure(username=mos_config.DUBTRACK_USERNAME, password=mos_config.DUBTRACK_PASSWORD)
bot.attach_backend(backend=dubtrack_backend)
# bot.attach_command_group(botcmd) #: Disabled until permissions are implemented
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]
},
install_requires=[
'abot==0.0.1a1.dev16',
'abot==0.0.1a1.post0.dev23',
'aiopg',
'alembic',
'asyncio-extras',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_run(
bot_mock.assert_called_once_with()
bot_object = bot_mock.return_value

dubtrackbotbackend_mock.assert_called_once_with()
dubtrackbotbackend_mock.assert_called_once_with(room='master-of-soundtrack')
dubtrack_backend_object = dubtrackbotbackend_mock.return_value
dubtrack_backend_object.configure.assert_called_once_with(
username=config.DUBTRACK_USERNAME,
Expand Down

0 comments on commit 9628fa6

Please sign in to comment.