Skip to content

Commit e8e0700

Browse files
Tadej Borovšaktadeboro
Tadej Borovšak
authored andcommitted
Enable linting of test folder
When we initially set up the lint make target, we forgot to include the tests folder in the flake8 check. This commit makes sure tests are also linted and fixes the issue we managed to accrue in our unit tests.
1 parent d865fdd commit e8e0700

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ format:
1111
.PHONY: lint
1212
lint:
1313
venv/bin/black --check --diff src/sensu_go tests
14-
venv/bin/flake8 src/sensu_go
14+
venv/bin/flake8 src/sensu_go tests
1515
venv/bin/mypy --strict src/sensu_go
1616

1717
.PHONY: unit

tests/unit/clients/http/test_base.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,21 @@ def test_default(self, mocker):
5757
session_mock.return_value.verify is True
5858

5959
def test_trailing_slash_removal(self, mocker):
60-
session_mock = mocker.patch("requests.Session")
61-
6260
client = DummyClient("https://my.url/")
6361

6462
assert client.address == "https://my.url"
6563

6664
def test_kill_verification(self, mocker):
6765
session_mock = mocker.patch("requests.Session")
6866

69-
client = DummyClient("https://my.url", verify=False)
67+
DummyClient("https://my.url", verify=False)
7068

7169
session_mock.return_value.verify is False
7270

7371
def test_use_custom_ca_bundle_for_verification(self, mocker):
7472
session_mock = mocker.patch("requests.Session")
7573

76-
client = DummyClient("https://my.url", ca_path="some_path")
74+
DummyClient("https://my.url", ca_path="some_path")
7775

7876
session_mock.return_value.verify == "some_path"
7977

@@ -91,7 +89,7 @@ def test_optional_parameter_combinations(
9189
):
9290
session_mock = mocker.patch("requests.Session")
9391

94-
client = DummyClient("https://my.url", verify=verify, ca_path=ca_path)
92+
DummyClient("https://my.url", verify=verify, ca_path=ca_path)
9593

9694
session_mock.return_value.verify == verify_result
9795

@@ -122,23 +120,23 @@ def test_right_method(self, requests_mock):
122120
client.get("/get/path")
123121

124122

125-
class TestHTTPClientGet:
123+
class TestHTTPClientPost:
126124
def test_right_method(self, requests_mock):
127125
requests_mock.post("https://my.url/post/path")
128126
client = DummyClient("https://my.url")
129127

130128
client.post("/post/path", dict(post="data"))
131129

132130

133-
class TestHTTPClientGet:
131+
class TestHTTPClientPut:
134132
def test_right_method(self, requests_mock):
135133
requests_mock.put("https://my.url/put/path")
136134
client = DummyClient("https://my.url")
137135

138136
client.put("/put/path", dict(put="data"))
139137

140138

141-
class TestHTTPClientGet:
139+
class TestHTTPClientDelete:
142140
def test_right_method(self, requests_mock):
143141
requests_mock.delete("https://my.url/delete/path")
144142
client = DummyClient("https://my.url")

0 commit comments

Comments
 (0)