diff options
author | Gauvain Pocentek <gauvain.pocentek@objectif-libre.com> | 2015-05-12 12:50:56 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain.pocentek@objectif-libre.com> | 2015-05-12 12:50:56 +0200 |
commit | c2d1f8e4e9fe5d94076da8bc836a99b89f6fe9af (patch) | |
tree | 7f4e5c7cb5a990df9fefe639af2eaece56bca643 /gitlab/tests | |
parent | 0032d468b5dc93b5bf9e639f382b4c869c5ef14c (diff) | |
download | gitlab-c2d1f8e4e9fe5d94076da8bc836a99b89f6fe9af.tar.gz |
use more pythonic names for some methods
Diffstat (limited to 'gitlab/tests')
-rw-r--r-- | gitlab/tests/test_gitlab.py | 12 | ||||
-rw-r--r-- | gitlab/tests/test_gitlabobject.py | 33 |
2 files changed, 23 insertions, 22 deletions
diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py index 0c7687c..dc23408 100644 --- a/gitlab/tests/test_gitlab.py +++ b/gitlab/tests/test_gitlab.py @@ -450,8 +450,8 @@ class TestGitLab(unittest.TestCase): email="testuser@test.com", password="testpassword", ssl_verify=True) - def test_setUrl(self): - self.gl.setUrl("http://new_url") + def test_set_url(self): + self.gl.set_url("http://new_url") self.assertEqual(self.gl._url, "http://new_url/api/v3") def test_set_token(self): @@ -532,7 +532,7 @@ class TestGitLab(unittest.TestCase): self.assertEqual(self.gl.user.id, id_) self.assertEqual(type(self.gl.user), CurrentUser) - def test_getListOrObject_without_id(self): + def test_get_list_or_object_without_id(self): @urlmatch(scheme="http", netloc="localhost", path="/api/v3/projects", method="get") def resp_cont(url, request): @@ -541,13 +541,13 @@ class TestGitLab(unittest.TestCase): return response(200, content, headers, None, 5, request) with HTTMock(resp_cont): - projs = Project._getListOrObject(self.gl, None) + projs = Project._get_list_or_object(self.gl, None) self.assertEqual(len(projs), 1) proj = projs[0] self.assertEqual(proj.id, 1) self.assertEqual(proj.name, "testproject") - def test_getListOrObject_with_id(self): + def test_get_list_or_object_with_id(self): @urlmatch(scheme="http", netloc="localhost", path="/api/v3/projects/1", method="get") def resp_cont(url, request): @@ -556,7 +556,7 @@ class TestGitLab(unittest.TestCase): return response(200, content, headers, None, 5, request) with HTTMock(resp_cont): - proj = Project._getListOrObject(self.gl, 1) + proj = Project._get_list_or_object(self.gl, 1) self.assertEqual(proj.id, 1) self.assertEqual(proj.name, "testproject") diff --git a/gitlab/tests/test_gitlabobject.py b/gitlab/tests/test_gitlabobject.py index f260b18..01e954b 100644 --- a/gitlab/tests/test_gitlabobject.py +++ b/gitlab/tests/test_gitlabobject.py @@ -162,39 +162,40 @@ class TestGitLabObject(unittest.TestCase): self.assertEqual(data[0].name, "name") self.assertEqual(data[0].id, 1) - def test_getListOrObject_with_list(self): + def test_get_list_or_object_with_list(self): with HTTMock(resp_list_project): gl_object = Project(self.gl, data={"name": "name"}) - data = gl_object._getListOrObject(self.gl, id=None) + data = gl_object._get_list_or_object(self.gl, id=None) self.assertEqual(type(data), list) self.assertEqual(len(data), 1) self.assertEqual(type(data[0]), Project) self.assertEqual(data[0].name, "name") self.assertEqual(data[0].id, 1) - def test_getListOrObject_with_get(self): + def test_get_list_or_object_with_get(self): with HTTMock(resp_get_project): gl_object = Project(self.gl, data={"name": "name"}) - data = gl_object._getListOrObject(self.gl, id=1) + data = gl_object._get_list_or_object(self.gl, id=1) self.assertEqual(type(data), Project) self.assertEqual(data.name, "name") self.assertEqual(data.id, 1) - def test_getListOrObject_cant_get(self): + def test_get_list_or_object_cant_get(self): with HTTMock(resp_get_issue): gl_object = Issue(self.gl, data={"name": "name"}) - self.assertRaises(NotImplementedError, gl_object._getListOrObject, + self.assertRaises(NotImplementedError, + gl_object._get_list_or_object, self.gl, id=1) - def test_getListOrObject_cantlist(self): + def test_get_list_or_object_cantlist(self): gl_object = CurrentUser(self.gl, data={"name": "name"}) - self.assertRaises(NotImplementedError, gl_object._getListOrObject, + self.assertRaises(NotImplementedError, gl_object._get_list_or_object, self.gl, id=None) - def test_getListOrObject_create(self): + def test_get_list_or_object_create(self): data = {"name": "name"} gl_object = Project(self.gl, data=data) - data = gl_object._getListOrObject(Project, id=data) + data = gl_object._get_list_or_object(Project, id=data) self.assertEqual(type(data), Project) self.assertEqual(data.name, "name") @@ -271,22 +272,22 @@ class TestGitLabObject(unittest.TestCase): obj = CurrentUser(self.gl, data={"name": "testname", "id": 1}) self.assertRaises(NotImplementedError, obj.delete) - def test_setFromDict_BooleanTrue(self): + def test_set_from_dict_BooleanTrue(self): obj = Project(self.gl, data={"name": "testname"}) data = {"issues_enabled": True} - obj._setFromDict(data) + obj._set_from_dict(data) self.assertIs(obj.issues_enabled, True) - def test_setFromDict_BooleanFalse(self): + def test_set_from_dict_BooleanFalse(self): obj = Project(self.gl, data={"name": "testname"}) data = {"issues_enabled": False} - obj._setFromDict(data) + obj._set_from_dict(data) self.assertIs(obj.issues_enabled, False) - def test_setFromDict_None(self): + def test_set_from_dict_None(self): obj = Project(self.gl, data={"name": "testname"}) data = {"issues_enabled": None} - obj._setFromDict(data) + obj._set_from_dict(data) self.assertIsNone(obj.issues_enabled) |