This commit is contained in:
parent
7fb62ce201
commit
4dad8eb1e7
5 changed files with 157 additions and 157 deletions
|
|
@ -7,11 +7,11 @@ from unittest.mock import MagicMock, call, patch
|
|||
from click.testing import CliRunner
|
||||
from requests import HTTPError
|
||||
|
||||
from transip_client.cli import run
|
||||
from transip_client.cli import update
|
||||
from transip_client.main import API_URL
|
||||
|
||||
|
||||
class RunTestCase(TestCase):
|
||||
class UpdateTestCase(TestCase):
|
||||
def setUp(self):
|
||||
patcher = patch("transip_client.main.requests.get")
|
||||
self.mocked_get = patcher.start()
|
||||
|
|
@ -67,7 +67,7 @@ class RunTestCase(TestCase):
|
|||
self.mocked_session.return_value.json.return_value = {"token": "token"}
|
||||
|
||||
result = self.runner.invoke(
|
||||
run,
|
||||
update,
|
||||
["my-user", str(self.private_key_path), "foobar.com"],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
|
|
@ -106,7 +106,7 @@ class RunTestCase(TestCase):
|
|||
self.mocked_get.side_effect = [HTTPError]
|
||||
|
||||
result = self.runner.invoke(
|
||||
run,
|
||||
update,
|
||||
["my-user", str(self.private_key_path), "foobar.com"],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
|
|
@ -182,7 +182,7 @@ class RunTestCase(TestCase):
|
|||
)
|
||||
|
||||
result = self.runner.invoke(
|
||||
run,
|
||||
update,
|
||||
["my-user", str(self.private_key_path), "foobar.com", "boofar.com"],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
|
|
@ -272,7 +272,7 @@ class RunTestCase(TestCase):
|
|||
self.mocked_session.return_value.json.return_value = {"token": "token"}
|
||||
|
||||
result = self.runner.invoke(
|
||||
run,
|
||||
update,
|
||||
["my-user", str(self.private_key_path), "foobar.com"],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
|
|
@ -318,7 +318,7 @@ class RunTestCase(TestCase):
|
|||
self.mocked_session.return_value.json.return_value = {"token": "token"}
|
||||
|
||||
result = self.runner.invoke(
|
||||
run,
|
||||
update,
|
||||
["my-user", str(self.private_key_path), "foobar.com", "--read-only"],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
|
|
@ -334,7 +334,7 @@ class RunTestCase(TestCase):
|
|||
|
||||
def test_no_domains(self):
|
||||
result = self.runner.invoke(
|
||||
run,
|
||||
update,
|
||||
["my-user", str(self.private_key_path)],
|
||||
catch_exceptions=True,
|
||||
)
|
||||
|
|
@ -347,7 +347,7 @@ class RunTestCase(TestCase):
|
|||
|
||||
def test_unknown_private_key_path(self):
|
||||
result = self.runner.invoke(
|
||||
run,
|
||||
update,
|
||||
["my-user", str("/tmp/foo"), "foobar.com"],
|
||||
catch_exceptions=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue