8000 add test cheking GitHubSession pickling · smakinson/github3.py@5da9970 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5da9970

Browse files
committed
add test cheking GitHubSession pickling
1 parent 33b4df8 commit 5da9970

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/unit/test_github_session.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import cPickle as pickle
12
import pytest
23

34
import requests
@@ -231,3 +232,14 @@ def test_retrieve_client_credentials_returns_none(self):
231232
"""
232233
s = self.build_session()
233234
assert s.retrieve_client_credentials() == (None, None)
235+
236+
def test_pickling(self):
237+
s = self.build_session('https://api.github.com')
238+
dumped = pickle.dumps(s, pickle.HIGHEST_PROTOCOL)
239+
loaded = pickle.loads(dumped)
240+
241+
assert hasattr(loaded, 'base_url')
242+
assert hasattr(loaded, 'two_factor_auth_cb')
243+
244+
assert loaded.base_url == s.base_url
245+
assert loaded.two_factor_auth_cb == s.two_factor_auth_cb

0 commit comments

Comments
 (0)
0