This commit is contained in:
sonny 2021-05-29 20:34:24 +02:00
parent e780024140
commit 698c7b947b
4 changed files with 218 additions and 166 deletions

View file

@ -1,10 +1,9 @@
import json
from unittest import TestCase, skipIf
from unittest import TestCase
from unittest.mock import call, patch
from click.testing import CliRunner
from pkg_resources import get_distribution
from requests import HTTPError
from transip_client.cli import DEFAULT_API_URL, run
@ -282,11 +281,6 @@ class RunTestCase(TestCase):
headers={"Authorization": "Bearer TOKEN"},
)
# see https://click.palletsprojects.com/en/master/changelog/#version-8-0
@skipIf(
get_distribution("click").version < "8",
"Multiple arguments through env variables not supported",
)
def test_multi_arg_env_var(self):
self.mocked_dns.return_value = b"111.420\n"
self.mocked_get.return_value.json.side_effect = [
@ -363,7 +357,8 @@ class RunTestCase(TestCase):
call().json(),
]
self.mocked_get.assert_has_calls(expected_calls)
# use any_order because of the asynchronous requests
self.mocked_get.assert_has_calls(expected_calls, any_order=True)
expected_json = json.dumps(
{
@ -393,7 +388,7 @@ class RunTestCase(TestCase):
call().raise_for_status(),
]
self.mocked_put.assert_has_calls(expected_calls)
self.mocked_put.assert_has_calls(expected_calls, any_order=True)
def test_no_domains(self):
result = self.runner.invoke(run, ["TOKEN"])