From 15ef37d89fe5866ec2f248014b29a25393976c7a Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 6 May 2023 16:25:26 -0700 Subject: [PATCH] Add test coverage for exact_options_completion() raising (#686). --- tests/unit/commands/test_completions.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/unit/commands/test_completions.py b/tests/unit/commands/test_completions.py index ec59698..12829d5 100644 --- a/tests/unit/commands/test_completions.py +++ b/tests/unit/commands/test_completions.py @@ -3,6 +3,7 @@ from collections import namedtuple from typing import Tuple import pytest +from flexmock import flexmock from borgmatic.commands import completion as module @@ -115,6 +116,16 @@ def test_exact_options_completion_produces_reasonable_completions( assert completion == '' +def test_exact_options_completion_raises_for_unexpected_action(): + flexmock(module).should_receive('has_exact_options').and_return(True) + flexmock(module).should_receive('has_file_options').and_return(False) + flexmock(module).should_receive('has_choice_options').and_return(False) + flexmock(module).should_receive('has_unknown_required_param_options').and_return(False) + + with pytest.raises(ValueError): + module.exact_options_completion(Action('--unknown', dest='unknown')) + + def test_dedent_strip_as_tuple_does_not_raise(): module.dedent_strip_as_tuple( '''