Skip to content

Commit 307b155

Browse files
committed
variaous fixes
1 parent a07c869 commit 307b155

24 files changed

Lines changed: 109 additions & 104 deletions

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ on:
1010

1111
jobs:
1212
lint:
13-
runs-on: ubuntu-22.04
13+
runs-on: ubuntu-latest
1414
steps:
1515
- name: Repository checkout
1616
uses: actions/checkout@v3
1717

1818
- name: Set up Python
1919
uses: actions/setup-python@v4
2020
with:
21-
python-version: "3.7"
21+
python-version: "3.8"
2222

2323
- name: Install dependencies
2424
run: |
@@ -29,11 +29,10 @@ jobs:
2929
tox -e lint
3030
3131
test:
32-
runs-on: ubuntu-22.04
32+
runs-on: ubuntu-latest
3333
strategy:
3434
matrix:
3535
python-version:
36-
- "3.7"
3736
- "3.8"
3837
- "3.9"
3938
- "3.10"

integrate/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Integration tests for `maas.client`."""
22

3-
from collections import Mapping
3+
from collections.abc import Mapping
44
from datetime import datetime
55
from http import HTTPStatus
66
import io

maas/client/bones/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ async def dispatch(self, uri, body, headers):
462462
library.
463463
"""
464464
insecure = self.action.handler.session.insecure
465-
connector = aiohttp.TCPConnector(verify_ssl=(not insecure))
465+
connector = aiohttp.TCPConnector(ssl=(not insecure))
466466
session = aiohttp.ClientSession(connector=connector)
467467
async with session:
468468
response = await session.request(

maas/client/bones/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def fetch_api_description(
4040
):
4141
"""Fetch the API description from the remote MAAS instance."""
4242
url_describe = urljoin(_ensure_url_string(url), "describe/")
43-
connector = aiohttp.TCPConnector(verify_ssl=(not insecure))
43+
connector = aiohttp.TCPConnector(ssl=(not insecure))
4444
session = aiohttp.ClientSession(connector=connector)
4545
async with session, session.get(url_describe) as response:
4646
if response.status != HTTPStatus.OK:
@@ -270,11 +270,11 @@ def check_response_is_okay(response):
270270
if response.status != HTTPStatus.OK:
271271
raise RemoteError(
272272
"{0} -> {1.status} {1.reason}".format(
273-
response.url_obj.human_repr(), response
273+
response.url.human_repr(), response
274274
)
275275
)
276276

277-
connector = aiohttp.TCPConnector(verify_ssl=(not insecure))
277+
connector = aiohttp.TCPConnector(ssl=(not insecure))
278278
session = aiohttp.ClientSession(connector=connector)
279279
async with session:
280280
# Check that this server supports `authenticate-api`.

maas/client/flesh/tests/test_controllers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_returns_table_with_controllers(self):
7373
output = yaml.safe_load(
7474
cmd.execute(origin, options, target=tabular.RenderTarget.yaml)
7575
)
76-
self.assertEquals(
76+
self.assertEqual(
7777
[
7878
{"name": "hostname", "title": "Hostname"},
7979
{"name": "node_type", "title": "Type"},
@@ -93,7 +93,7 @@ def test_returns_table_with_controllers(self):
9393
}
9494
for controller in racks + regions
9595
}
96-
self.assertEquals(
96+
self.assertEqual(
9797
sorted(controller_output.values(), key=itemgetter("hostname")),
9898
output["data"],
9999
)

maas/client/flesh/tests/test_devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_returns_table_with_devices(self):
5252
output = yaml.safe_load(
5353
cmd.execute(origin, options, target=tabular.RenderTarget.yaml)
5454
)
55-
self.assertEquals(
55+
self.assertEqual(
5656
[
5757
{"name": "hostname", "title": "Hostname"},
5858
{"name": "owner", "title": "Owner"},
@@ -76,7 +76,7 @@ def test_returns_table_with_devices(self):
7676
],
7777
key=itemgetter("hostname"),
7878
)
79-
self.assertEquals(devices_output, output["data"])
79+
self.assertEqual(devices_output, output["data"])
8080

8181
def test_calls_handler_with_hostnames(self):
8282
origin = make_origin()

maas/client/flesh/tests/test_machines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_returns_table_with_machines(self):
6060
output = yaml.safe_load(
6161
cmd.execute(origin, options, target=tabular.RenderTarget.yaml)
6262
)
63-
self.assertEquals(
63+
self.assertEqual(
6464
[
6565
{"name": "hostname", "title": "Hostname"},
6666
{"name": "power", "title": "Power"},
@@ -91,7 +91,7 @@ def test_returns_table_with_machines(self):
9191
],
9292
key=itemgetter("hostname"),
9393
)
94-
self.assertEquals(machines_output, output["data"])
94+
self.assertEqual(machines_output, output["data"])
9595

9696
def test_calls_handler_with_hostnames(self):
9797
origin = make_origin()

maas/client/flesh/tests/test_nodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_returns_table_with_nodes(self):
5151
output = yaml.safe_load(
5252
cmd.execute(origin, options, target=tabular.RenderTarget.yaml)
5353
)
54-
self.assertEquals(
54+
self.assertEqual(
5555
[
5656
{"name": "hostname", "title": "Hostname"},
5757
{"name": "node_type", "title": "Type"},
@@ -65,7 +65,7 @@ def test_returns_table_with_nodes(self):
6565
],
6666
key=itemgetter("hostname"),
6767
)
68-
self.assertEquals(nodes_output, output["data"])
68+
self.assertEqual(nodes_output, output["data"])
6969

7070
def test_calls_handler_with_hostnames(self):
7171
origin = make_origin()

maas/client/utils/tests/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,4 +550,4 @@ class TestRemoveNone(TestCase):
550550

551551
def test_removes_all_None_values(self):
552552
data = {"None": None, "another_None": None, "keep": "value"}
553-
self.assertEquals({"keep": "value"}, utils.remove_None(data))
553+
self.assertEqual({"keep": "value"}, utils.remove_None(data))

maas/client/utils/tests/test_diff.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,27 @@ class TestCalculateDictDiff(TestCase):
2626
def test_calcs_no_difference(self):
2727
orig_data = {"key1": "value1", "key2": "value2"}
2828
new_data = copy.deepcopy(orig_data)
29-
self.assertEquals({}, calculate_dict_diff(orig_data, new_data))
29+
self.assertEqual({}, calculate_dict_diff(orig_data, new_data))
3030

3131
def test_calcs_changed_value(self):
3232
orig_data = {"key1": "value1", "key2": "value2"}
3333
new_data = copy.deepcopy(orig_data)
3434
new_data["key2"] = "new_value"
35-
self.assertEquals(
35+
self.assertEqual(
3636
{"key2": "new_value"}, calculate_dict_diff(orig_data, new_data)
3737
)
3838

3939
def test_calcs_deleted_value(self):
4040
orig_data = {"key1": "value1", "key2": "value2"}
4141
new_data = copy.deepcopy(orig_data)
4242
del new_data["key2"]
43-
self.assertEquals({"key2": ""}, calculate_dict_diff(orig_data, new_data))
43+
self.assertEqual({"key2": ""}, calculate_dict_diff(orig_data, new_data))
4444

4545
def test_calcs_changes_and_deleted(self):
4646
orig_data = {"key1": "value1", "key2": "value2"}
4747
new_data = copy.deepcopy(orig_data)
4848
new_data["key1"] = "new_value"
4949
del new_data["key2"]
50-
self.assertEquals(
50+
self.assertEqual(
5151
{"key1": "new_value", "key2": ""}, calculate_dict_diff(orig_data, new_data)
5252
)

0 commit comments

Comments
 (0)