diff options
author | Gauvain Pocentek <gauvain.pocentek@objectif-libre.com> | 2016-01-09 08:36:18 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain.pocentek@objectif-libre.com> | 2016-01-09 08:36:18 +0100 |
commit | 5513d0f52cd488b14c94389a09d01877fa5596e0 (patch) | |
tree | 4e8dab28f2c95e8214cfc1a4d4d39f1e4295007d /gitlab/tests | |
parent | 0ae315a4d1d154122208883bd006b2b882cb5113 (diff) | |
download | gitlab-5513d0f52cd488b14c94389a09d01877fa5596e0.tar.gz |
Add support for groups search
Factorize the code to avoid duplication with the ProjectManager class.
Implement unit tests for the group search.
Original patchh from Daniel Serodio (PR #55).
Diffstat (limited to 'gitlab/tests')
-rw-r--r-- | gitlab/tests/test_manager.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gitlab/tests/test_manager.py b/gitlab/tests/test_manager.py index bba278f..041537c 100644 --- a/gitlab/tests/test_manager.py +++ b/gitlab/tests/test_manager.py @@ -214,3 +214,26 @@ class TestGitlabManager(unittest.TestCase): self.assertEqual(data[1].name, "foo2") self.assertEqual(data[0].id, 1) self.assertEqual(data[1].id, 2) + + def test_group_manager_search(self): + mgr = GroupManager(self.gitlab) + + @urlmatch(scheme="http", netloc="localhost", path="/api/v3/groups", + query="search=foo", method="get") + def resp_get_search(url, request): + headers = {'content-type': 'application/json'} + content = ('[{"name": "foo1", "id": 1}, ' + '{"name": "foo2", "id": 2}]') + content = content.encode("utf-8") + return response(200, content, headers, None, 5, request) + + with HTTMock(resp_get_search): + data = mgr.search('foo') + self.assertEqual(type(data), list) + self.assertEqual(2, len(data)) + self.assertEqual(type(data[0]), Group) + self.assertEqual(type(data[1]), Group) + self.assertEqual(data[0].name, "foo1") + self.assertEqual(data[1].name, "foo2") + self.assertEqual(data[0].id, 1) + self.assertEqual(data[1].id, 2) |