mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-05-04 23:55:08 -04:00
improve messaging when brozzler-stop-crawl is passed nonexistent seed/job id
This commit is contained in:
parent
b3fa7a4e39
commit
ba519d7288
3 changed files with 27 additions and 2 deletions
|
@ -21,6 +21,7 @@ import brozzler.cli
|
|||
import pkg_resources
|
||||
import pytest
|
||||
import subprocess
|
||||
import doublethink
|
||||
|
||||
def cli_commands():
|
||||
commands = set(pkg_resources.get_entry_map(
|
||||
|
@ -36,7 +37,6 @@ def cli_commands():
|
|||
commands.remove('brozzler-easy')
|
||||
return commands
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cmd', cli_commands())
|
||||
def test_call_entrypoint(capsys, cmd):
|
||||
entrypoint = pkg_resources.get_entry_map(
|
||||
|
@ -57,3 +57,22 @@ def test_run_command(capsys, cmd):
|
|||
brozzler.__version__, cmd)).encode('ascii')
|
||||
assert err == b''
|
||||
|
||||
def test_rethinkdb_up():
|
||||
'''Check that rethinkdb is up and running.'''
|
||||
# check that rethinkdb is listening and looks sane
|
||||
rr = doublethink.Rethinker(db='rethinkdb') # built-in db
|
||||
tbls = rr.table_list().run()
|
||||
assert len(tbls) > 10
|
||||
|
||||
def test_stop_nonexistent_crawl(capsys):
|
||||
with pytest.raises(SystemExit):
|
||||
brozzler.cli.brozzler_stop_crawl(['brozzler-stop-crawl', '--site=123'])
|
||||
out, err = capsys.readouterr()
|
||||
assert err.endswith('site not found with id=123\n')
|
||||
assert out == ''
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
brozzler.cli.brozzler_stop_crawl(['brozzler-stop-crawl', '--job=abc'])
|
||||
out, err = capsys.readouterr()
|
||||
assert err.endswith('''job not found with id='abc'\n''')
|
||||
assert out == ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue