mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
|
'''
|
||
|
test_cli.py - unit tests for doublethink CLI
|
||
|
|
||
|
Copyright (C) 2015-2017 Internet Archive
|
||
|
|
||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
you may not use this file except in compliance with the License.
|
||
|
You may obtain a copy of the License at
|
||
|
|
||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
||
|
Unless required by applicable law or agreed to in writing, software
|
||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
See the License for the specific language governing permissions and
|
||
|
limitations under the License.
|
||
|
'''
|
||
|
|
||
|
import doublethink
|
||
|
import logging
|
||
|
import sys
|
||
|
import pytest
|
||
|
import rethinkdb as r
|
||
|
|
||
|
logging.basicConfig(stream=sys.stderr, level=logging.INFO,
|
||
|
format="%(asctime)s %(process)d %(levelname)s %(threadName)s %(name)s.%(funcName)s(%(filename)s:%(lineno)d) %(message)s")
|
||
|
|
||
|
@pytest.fixture(scope="module")
|
||
|
def rr():
|
||
|
rr = RethinkerForTesting()
|
||
|
try:
|
||
|
rr.db_drop("doublethink_test_db").run()
|
||
|
except r.errors.ReqlOpFailedError:
|
||
|
pass
|
||
|
result = rr.db_create("doublethink_test_db").run()
|
||
|
assert not rr.last_conn.is_open()
|
||
|
assert result["dbs_created"] == 1
|
||
|
return RethinkerForTesting(db="doublethink_test_db")
|
||
|
|
||
|
def test_cli(rr):
|
||
|
print(rr)
|
||
|
doublethink.cli.purge_stale_services(['test'])
|