aboutsummaryrefslogtreecommitdiff
path: root/src/vgstash
diff options
context:
space:
mode:
Diffstat (limited to 'src/vgstash')
-rw-r--r--src/vgstash/test_vgstash_cli.py46
1 files changed, 42 insertions, 4 deletions
diff --git a/src/vgstash/test_vgstash_cli.py b/src/vgstash/test_vgstash_cli.py
index 5ba7d30..ecb23c1 100644
--- a/src/vgstash/test_vgstash_cli.py
+++ b/src/vgstash/test_vgstash_cli.py
@@ -6,7 +6,15 @@ import vgstash_cli
from click.testing import CliRunner
-verbose = True
+verbose = False
+interactive = False
+
+# Change this to suit your testing environment
+if not interactive:
+ os.environ['EDITOR'] = "cat"
+else:
+ if not os.getenv("EDITOR"):
+ os.environ['EDITOR'] = "vim"
def test_init():
runner = CliRunner()
@@ -146,11 +154,11 @@ def test_list_pretty_tiny():
def test_delete():
runner = CliRunner()
- result = runner.invoke(vgstash_cli.cli, ['delete', 'Vectorman 2', 'Genesis'])
+ result = runner.invoke(vgstash_cli.cli, ['delete', 'Vectorman', 'Genesis'])
if verbose:
print(result.output)
assert result.exit_code == 0
- assert result.output == "Removed Vectorman 2 for Genesis from your collection.\n"
+ assert result.output == "Removed Vectorman for Genesis from your collection.\n"
def test_update():
@@ -169,7 +177,37 @@ def test_update():
'Title | System | Own | Progress',
'----------------------------------------',
'Sonic the H | Genesis | | B',
- 'Vectorman | Genesis | | B',
+ 'Vectorman 2 | Genesis | P | P',
'Super Mario | NES | P | C',
'The Legend | NES | D | P\n'
))
+
+def test_notes():
+ runner = CliRunner()
+ result = runner.invoke(vgstash_cli.cli, ['notes', 'Vectorman 2', 'Genesis'])
+ if verbose:
+ print(result.output)
+ assert result.exit_code == 0
+ assert result.output == "\n".join((
+ 'Notes for Vectorman 2 on Genesis:',
+ '',
+ 'beep',
+ 'boop\n'
+ ))
+
+def test_notes_edit():
+ if not interactive:
+ return
+ runner = CliRunner()
+ result = runner.invoke(vgstash_cli.cli, ['notes', 'Vectorman 2', 'Genesis', '-e'])
+ if verbose:
+ print(result.output)
+ assert result.exit_code == 0
+ assert result.output == "Notes for Vectorman 2 on Genesis have been updated!\n"
+
+ # List the results to make sure they match what the editor has.
+ list_runner = CliRunner()
+ list_result = runner.invoke(vgstash_cli.cli, ['list', '-r'])
+ if verbose:
+ print(list_result.output)
+ assert list_result.exit_code == 0