Skip to content

Commit 824afcd

Browse files
committed
fix linting errors
1 parent b0a6582 commit 824afcd

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

tests/posit/connect/test_client.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def test_me_request(self):
219219
con = Client(api_key="12345", url="https://connect.example/")
220220
assert con.me["username"] == "carlos12"
221221

222+
@responses.activate
222223
def test_request(self, MockSession):
223224
api_key = "12345"
224225
url = "https://connect.example.com"
@@ -234,35 +235,45 @@ def test_get(self, MockSession):
234235
url = "https://connect.example.com"
235236
client = Client(api_key=api_key, url=url)
236237
client.get("/foo")
237-
client.session.get.assert_called_once_with("https://connect.example.com/__api__/foo")
238+
MockSession.return_value.get.assert_called_once_with(
239+
"https://connect.example.com/__api__/foo"
240+
)
238241

239242
def test_post(self, MockSession):
240243
api_key = "12345"
241244
url = "https://connect.example.com"
242245
client = Client(api_key=api_key, url=url)
243246
client.post("/foo")
244-
client.session.post.assert_called_once_with("https://connect.example.com/__api__/foo")
247+
MockSession.return_value.post.assert_called_once_with(
248+
"https://connect.example.com/__api__/foo"
249+
)
245250

246251
def test_put(self, MockSession):
247252
api_key = "12345"
248253
url = "https://connect.example.com"
249254
client = Client(api_key=api_key, url=url)
250255
client.put("/foo")
251-
client.session.put.assert_called_once_with("https://connect.example.com/__api__/foo")
256+
MockSession.return_value.put.assert_called_once_with(
257+
"https://connect.example.com/__api__/foo"
258+
)
252259

253260
def test_patch(self, MockSession):
254261
api_key = "12345"
255262
url = "https://connect.example.com"
256263
client = Client(api_key=api_key, url=url)
257264
client.patch("/foo")
258-
client.session.patch.assert_called_once_with("https://connect.example.com/__api__/foo")
265+
MockSession.return_value.patch.assert_called_once_with(
266+
"https://connect.example.com/__api__/foo"
267+
)
259268

260269
def test_delete(self, MockSession):
261270
api_key = "12345"
262271
url = "https://connect.example.com"
263272
client = Client(api_key=api_key, url=url)
264273
client.delete("/foo")
265-
client.session.delete.assert_called_once_with("https://connect.example.com/__api__/foo")
274+
MockSession.return_value.delete.assert_called_once_with(
275+
"https://connect.example.com/__api__/foo"
276+
)
266277

267278

268279
class TestClientOAuth:

tests/posit/connect/test_hooks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,8 @@ def test_deprecation_warning():
7777
)
7878
c = Client("https://connect.example", "12345")
7979

80-
with pytest.warns(DeprecationWarning):
80+
with pytest.warns(
81+
DeprecationWarning,
82+
match="https://connect.example/__api__/v0 is deprecated and will be removed in a future version of Connect. Please upgrade `posit-sdk` in order to use the new APIs.",
83+
):
8184
c.get("v0")

0 commit comments

Comments
 (0)