diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pyscript/media_movies_add1.py | 1 | ||||
-rw-r--r-- | tests/pyscript/media_movies_list4.py | 2 | ||||
-rw-r--r-- | tests/pyscript/media_movies_list5.py | 1 | ||||
-rw-r--r-- | tests/pyscript/media_movies_list6.py | 1 | ||||
-rw-r--r-- | tests/pyscript/media_movies_list7.py | 1 | ||||
-rw-r--r-- | tests/test_pyscript.py | 30 |
6 files changed, 35 insertions, 1 deletions
diff --git a/tests/pyscript/media_movies_add1.py b/tests/pyscript/media_movies_add1.py new file mode 100644 index 00000000..a9139cb1 --- /dev/null +++ b/tests/pyscript/media_movies_add1.py @@ -0,0 +1 @@ +app.media.movies.add('My Movie', 'PG-13', director=('George Lucas', 'J. J. Abrams')) diff --git a/tests/pyscript/media_movies_list4.py b/tests/pyscript/media_movies_list4.py index 0124bbcb..1165b0c5 100644 --- a/tests/pyscript/media_movies_list4.py +++ b/tests/pyscript/media_movies_list4.py @@ -1 +1 @@ -app.media.movies.list()
\ No newline at end of file +app.media.movies.list(actor='Mark Hamill') diff --git a/tests/pyscript/media_movies_list5.py b/tests/pyscript/media_movies_list5.py new file mode 100644 index 00000000..962b1516 --- /dev/null +++ b/tests/pyscript/media_movies_list5.py @@ -0,0 +1 @@ +app.media.movies.list(actor=('Mark Hamill', 'Carrie Fisher')) diff --git a/tests/pyscript/media_movies_list6.py b/tests/pyscript/media_movies_list6.py new file mode 100644 index 00000000..5f8d3654 --- /dev/null +++ b/tests/pyscript/media_movies_list6.py @@ -0,0 +1 @@ +app.media.movies.list(rating='PG') diff --git a/tests/pyscript/media_movies_list7.py b/tests/pyscript/media_movies_list7.py new file mode 100644 index 00000000..bb0e28bb --- /dev/null +++ b/tests/pyscript/media_movies_list7.py @@ -0,0 +1 @@ +app.media.movies.list(rating=('PG', 'PG-13')) diff --git a/tests/test_pyscript.py b/tests/test_pyscript.py index 36970ddf..24626243 100644 --- a/tests/test_pyscript.py +++ b/tests/test_pyscript.py @@ -100,6 +100,12 @@ def test_pyscript_help(ps_app, capsys, request, command, pyscript_file): ('media movies list', 'media_movies_list1.py'), ('media movies list', 'media_movies_list2.py'), ('media movies list', 'media_movies_list3.py'), + ('media movies list -a "Mark Hamill"', 'media_movies_list4.py'), + ('media movies list -a "Mark Hamill" -a "Carrie Fisher"', 'media_movies_list5.py'), + ('media movies list -r PG', 'media_movies_list6.py'), + ('media movies list -r PG PG-13', 'media_movies_list7.py'), + ('media movies add "My Movie" PG-13 --director "George Lucas" "J. J. Abrams"', + 'media_movies_add1.py'), ]) def test_pyscript_out(ps_app, capsys, request, command, pyscript_file): test_dir = os.path.dirname(request.module.__file__) @@ -113,3 +119,27 @@ def test_pyscript_out(ps_app, capsys, request, command, pyscript_file): assert len(out) > 0 assert out == expected + +@pytest.mark.parametrize('command', [ + 'app.noncommand', + 'app.media.noncommand', +]) +def test_pyscript_unknown_command(ps_app, capsys, command): + run_cmd(ps_app, 'py {}'.format(command)) + _, err = capsys.readouterr() + + assert len(err) > 0 + assert 'Traceback' in err + assert 'AttributeError' in err + + +@pytest.mark.parametrize('command', [ + 'app.media.movies.list(artist="Invalid Keyword")', +]) +def test_pyscript_unknown_kw(ps_app, capsys, command): + run_cmd(ps_app, 'py {}'.format(command)) + _, err = capsys.readouterr() + + assert len(err) > 0 + assert 'Traceback' in err + assert 'TypeError' in err |