0.3
This commit is contained in:
parent
e780024140
commit
698c7b947b
4 changed files with 218 additions and 166 deletions
|
|
@ -1,10 +1,12 @@
|
|||
import json
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
@ -70,7 +72,7 @@ def _update_domains(updated_domains, api_url, token, read_only):
|
|||
|
||||
try:
|
||||
response.raise_for_status()
|
||||
except request.HTTPError as e:
|
||||
except requests.HTTPError:
|
||||
logger.exception(f"Unable to update domain {domain}")
|
||||
continue
|
||||
|
||||
|
|
|
|||
|
|
@ -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"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue