From 226e6ce9e5217367c896125a2b4b9d16afd2cf94 Mon Sep 17 00:00:00 2001 From: Lyudmil Nenov Date: Fri, 3 Nov 2017 16:05:17 +0200 Subject: Module's base objects serialization (#359) Make gitlab objects serializable With current implementation of API v3 and v4 support, some instances have properties of type module and are not serializable. Handle these properties manually with setstate and getstate methods. --- gitlab/tests/test_gitlab.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gitlab/tests/test_gitlab.py') diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py index 0f39624..027de0c 100644 --- a/gitlab/tests/test_gitlab.py +++ b/gitlab/tests/test_gitlab.py @@ -18,6 +18,7 @@ from __future__ import print_function +import pickle try: import unittest except ImportError: @@ -890,6 +891,14 @@ class TestGitlab(unittest.TestCase): email="testuser@test.com", password="testpassword", ssl_verify=True) + def test_pickability(self): + original_gl_objects = self.gl._objects + pickled = pickle.dumps(self.gl) + unpickled = pickle.loads(pickled) + self.assertIsInstance(unpickled, Gitlab) + self.assertTrue(hasattr(unpickled, '_objects')) + self.assertEqual(unpickled._objects, original_gl_objects) + def test_credentials_auth_nopassword(self): self.gl.email = None self.gl.password = None -- cgit v1.2.1