Skip to content

Commit

Permalink
Merge pull request #877 from theodesp/Issue-809
Browse files Browse the repository at this point in the history
Fixed #809 - Added tests for various cli config parameters
  • Loading branch information
selwin authored Sep 9, 2017
2 parents fa6c28b + 0fab93d commit 19bc288
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/dummy_settings_override.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)

REDIS_HOST = "testhost.example.com"
REDIS_PORT = 6378
REDIS_DB = 2
REDIS_PASSWORD = '123'
42 changes: 42 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,48 @@ def test_config_file_option(self):
result = runner.invoke(main, ['info', '--config', cli_config.config])
self.assertEqual(result.exit_code, 1)

def test_config_file_default_options(self):
""""""
cli_config = CliConfig(config='tests.dummy_settings')

self.assertEqual(
cli_config.connection.connection_pool.connection_kwargs['host'],
'testhost.example.com',
)
self.assertEqual(
cli_config.connection.connection_pool.connection_kwargs['port'],
6379
)
self.assertEqual(
cli_config.connection.connection_pool.connection_kwargs['db'],
0
)
self.assertEqual(
cli_config.connection.connection_pool.connection_kwargs['password'],
None
)

def test_config_file_default_options_override(self):
""""""
cli_config = CliConfig(config='tests.dummy_settings_override')

self.assertEqual(
cli_config.connection.connection_pool.connection_kwargs['host'],
'testhost.example.com',
)
self.assertEqual(
cli_config.connection.connection_pool.connection_kwargs['port'],
6378
)
self.assertEqual(
cli_config.connection.connection_pool.connection_kwargs['db'],
2
)
self.assertEqual(
cli_config.connection.connection_pool.connection_kwargs['password'],
'123'
)

def test_empty_nothing(self):
"""rq empty -u <url>"""
runner = CliRunner()
Expand Down

0 comments on commit 19bc288

Please sign in to comment.