Commit f6b7f864 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME
Browse files

[test][test_config] Use nose.eq_ instead of assert and remove unused

func
parent b0f60d0b
......@@ -43,21 +43,10 @@ from .. import common
from beat.cmdline.scripts import main_cli
def call(*args, **kwargs):
'''A central mechanism to call the main routine with the right parameters'''
use_prefix = kwargs.get('prefix', tmp_prefix)
return main((
'--prefix=%s' % use_prefix,
'--test-mode',
) + args)
def test_config_list():
runner = CliRunner()
result = runner.invoke(main_cli.main, ['config', 'show'])
assert result.exit_code == 0, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 0, result.output)
......@@ -79,7 +68,7 @@ def test_set_local_token():
with runner.isolated_filesystem():
result = runner.invoke(main_cli.main, ['config', 'set', '--local',
'token', token_value])
assert result.exit_code == 0, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 0, result.output)
config = '.beatrc'
assert os.path.exists(config)
with open(config, 'rt') as f: contents = simplejson.load(f)
......@@ -93,7 +82,7 @@ def test_set_local_multiple():
with runner.isolated_filesystem():
result = runner.invoke(main_cli.main, ['config', 'set', '--local',
'token', token_value])
assert result.exit_code == 0, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 0, result.output)
config = '.beatrc'
assert os.path.exists(config)
with open(config, 'rt') as f: contents = simplejson.load(f)
......@@ -103,7 +92,7 @@ def test_set_local_multiple():
token_value = '123456'
result = runner.invoke(main_cli.main, ['config', 'set', '--local',
'token', token_value])
assert result.exit_code == 0, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 0, result.output)
assert os.path.exists(config)
with open(config, 'rt') as f: contents = simplejson.load(f)
assert contents['token'] == token_value
......@@ -117,7 +106,7 @@ def test_set_local_atnt_db():
with runner.isolated_filesystem():
result = runner.invoke(main_cli.main, ['config', 'set', '--local',
db_config, db_path])
assert result.exit_code == 0, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 0, result.output)
config = '.beatrc'
assert os.path.exists(config)
with open(config, 'rt') as f: contents = simplejson.load(f)
......@@ -132,9 +121,9 @@ def test_set_get_local_atnt_db():
with runner.isolated_filesystem():
result = runner.invoke(main_cli.main, ['config', 'set', '--local',
db_config, db_path])
assert result.exit_code == 0, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 0, result.output)
result = runner.invoke(main_cli.main, ['config', 'get', db_config])
assert result.exit_code == 0, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 0, result.output)
assert db_path in result.output
......@@ -145,7 +134,7 @@ def test_set_bad_config_key():
with runner.isolated_filesystem():
result = runner.invoke(main_cli.main, ['config', 'set', '--local',
db_config, db_config])
assert result.exit_code == 1, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 1, result.output)
@nose.tools.with_setup(teardown=cleanup)
......@@ -154,7 +143,7 @@ def test_get_bad_config_key():
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(main_cli.main, ['config', 'get', db_config])
assert result.exit_code == -1, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, -1, result.output)
@nose.tools.with_setup(teardown=cleanup)
......@@ -162,7 +151,7 @@ def test_get_token():
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(main_cli.main, ['config', 'get', 'token'])
assert result.exit_code == 0, (result.exit_code, result.output)
nose.tools.eq_(result.exit_code, 0, result.output)
@nose.tools.with_setup(teardown=cleanup)
def test_get_editor():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment