specter-desktop/tests/test_util_shell.py
Kim Neunert 8dd294ba26
Service class refactoring (#1623)
* windows compatibility

* fix broken images in plugin-chooser

* Adding to the wishlist easily

* scheduler callbacks

* More sophisticated process of distinguishing exts from specter-desktop for dynamic extension-loading

* bugfix grep

* adding apscheduler as requirement

* Proper scheduler implementation

* Update src/cryptoadvance/specter/services/callbacks.py

Co-authored-by: Manolis <70536101+moneymanolis@users.noreply.github.com>

* Frontend renaming to plugins

* sanity-check and docs

* bugfix and docs

Co-authored-by: Manolis <70536101+moneymanolis@users.noreply.github.com>
2022-03-21 13:57:55 +01:00

29 lines
848 B
Python

import logging
def test_which(caplog):
caplog.set_level(logging.INFO)
caplog.set_level(logging.DEBUG, logger="cryptoadvance.specter")
import cryptoadvance.specter.util.shell as helpers
try:
helpers.which("some_non_existing_binary")
assert False, "Should raise an Exception"
except:
pass
assert (
helpers.which("date") == "/bin/date" or helpers.which("date") == "/usr/bin/date"
) # travis-CI has it on /bin/date
def test_last_lines(caplog):
from cryptoadvance.specter.util.shell import get_last_lines_from_file
lines = get_last_lines_from_file("LICENSE", 30)
assert lines[-2].startswith("OUT OF OR IN CONNECTION WITH THE SOFTWARE ")
def test_grep():
from cryptoadvance.specter.util.shell import grep
assert grep("./setup.py", 'name="cryptoadvance.specter",')