Skip to content

Commit

Permalink
TST: create: Add test for missing but required backend parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleam committed Oct 15, 2018
1 parent 3d80d98 commit d396235
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions niceman/interface/tests/test_create.py
Expand Up @@ -12,6 +12,7 @@
import pytest
from mock import patch, call, MagicMock

from niceman.api import create
from niceman.cmdline.main import main
from niceman.utils import swallow_logs
from niceman.resource.base import ResourceManager
Expand Down Expand Up @@ -64,6 +65,15 @@ def test_create_interface():
assert_in("Created the environment my-test-resource", log.lines)


def test_create_missing_required():
with pytest.raises(ResourceError) as exc:
# SSH requires host.
with patch("niceman.interface.create.get_manager",
return_value=ResourceManager()):
create("somessh", "ssh", [])
assert "host" in str(exc.value)


def test_backend_help_wrong_backend():
with pytest.raises(ResourceError) as exc:
backend_help("unknown_backend")
Expand Down

0 comments on commit d396235

Please sign in to comment.