Skip to content

Commit e9cee62

Browse files
committed
test that calling the disconnect() method causes HTTP sessions to close
This is similar to the test we are doing in the case of the "with" statement, but we're making sure that calling .disconnect() directly causes the same effect.
1 parent 4de3956 commit e9cee62

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/test_connect.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
import pypuppetdb
44

55

6-
def test_connect_api():
6+
@mock.patch('pypuppetdb.api.requests.Session.close')
7+
def test_connect_api(session_close):
78
puppetdb = pypuppetdb.connect()
89
assert puppetdb.version == 'v4'
910

11+
puppetdb.disconnect()
12+
assert session_close.called
13+
1014

1115
@mock.patch('pypuppetdb.api.requests.Session.close')
1216
def test_connect_with_statement(session_close):

0 commit comments

Comments
 (0)