-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_cli.py
37 lines (28 loc) · 1.15 KB
/
test_cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
""" Tests for command line interface."""
from click.testing import CliRunner
from aiida.plugins import DataFactory
from aiida_cattools.cli import export, list_
# pylint: disable=attribute-defined-outside-init
class TestDataCli:
"""Test verdi data cli plugin."""
def setup_method(self):
"""Prepare nodes for cli tests."""
DiffParameters = DataFactory("cattools")
self.parameters = DiffParameters({"ignore-case": True})
self.parameters.store()
self.runner = CliRunner()
def test_data_diff_list(self):
"""Test 'verdi data cattools list'
Tests that it can be reached and that it lists the node we have set up.
"""
result = self.runner.invoke(list_, catch_exceptions=False)
assert str(self.parameters.pk) in result.output
def test_data_diff_export(self):
"""Test 'verdi data cattools export'
Tests that it can be reached and that it shows the contents of the node
we have set up.
"""
result = self.runner.invoke(
export, [str(self.parameters.pk)], catch_exceptions=False
)
assert "ignore-case" in result.output