summaryrefslogtreecommitdiff
path: root/gitlab/tests
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2016-01-23 16:48:39 +0100
committerGauvain Pocentek <gauvain.pocentek@objectif-libre.com>2016-01-23 16:48:39 +0100
commitd7271b12e91c90ad7216073354085ed2b0257f73 (patch)
tree726ea8f4ea571f7ca5e61bb651ddd9defe18f98f /gitlab/tests
parent982f54fb174f23e60ed40577af2d62f281d83c10 (diff)
downloadgitlab-d7271b12e91c90ad7216073354085ed2b0257f73.tar.gz
Fix the json() method for python 3
Also add unit tests and fix pep8 test
Diffstat (limited to 'gitlab/tests')
-rw-r--r--gitlab/tests/test_gitlabobject.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/gitlab/tests/test_gitlabobject.py b/gitlab/tests/test_gitlabobject.py
index 99a184b..2726854 100644
--- a/gitlab/tests/test_gitlabobject.py
+++ b/gitlab/tests/test_gitlabobject.py
@@ -21,6 +21,7 @@ from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
+import json
try:
import unittest
except ImportError:
@@ -150,6 +151,14 @@ class TestGitlabObject(unittest.TestCase):
email="testuser@test.com", password="testpassword",
ssl_verify=True)
+ def test_json(self):
+ gl_object = CurrentUser(self.gl, data={"username": "testname"})
+ json_str = gl_object.json()
+ data = json.loads(json_str)
+ self.assertIn("id", data)
+ self.assertEqual(data["username"], "testname")
+ self.assertEqual(data["gitlab"]["url"], "http://localhost/api/v3")
+
def test_list_not_implemented(self):
self.assertRaises(NotImplementedError, CurrentUser.list, self.gl)