summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-06-19 21:15:50 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2016-06-19 21:15:50 +0200
commit79feb87bd98caac008da2337c01fd7e3624d37f6 (patch)
tree2797e167205203807daca1fc7cd00a286add97a5
parentdbad3bd007aaa0e4a19a9f3bc87924018f311290 (diff)
downloadgitlab-79feb87bd98caac008da2337c01fd7e3624d37f6.tar.gz
add support for namespaces
-rw-r--r--gitlab/__init__.py2
-rw-r--r--gitlab/objects.py13
-rw-r--r--tools/python_test.py6
3 files changed, 21 insertions, 0 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index a8e0fe6..836aaea 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -73,6 +73,7 @@ class Gitlab(object):
hooks (HookManager): Manager for GitLab hooks
issues (IssueManager): Manager for GitLab issues
licenses (LicenseManager): Manager for licenses
+ namespaces (NamespaceManager): Manager for namespaces
project_branches (ProjectBranchManager): Manager for GitLab projects
branches
project_commits (ProjectCommitManager): Manager for GitLab projects
@@ -143,6 +144,7 @@ class Gitlab(object):
self.hooks = HookManager(self)
self.issues = IssueManager(self)
self.licenses = LicenseManager(self)
+ self.namespaces = NamespaceManager(self)
self.project_branches = ProjectBranchManager(self)
self.project_commits = ProjectCommitManager(self)
self.project_commit_comments = ProjectCommitCommentManager(self)
diff --git a/gitlab/objects.py b/gitlab/objects.py
index 2ea875b..96fffde 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -782,6 +782,19 @@ class LicenseManager(BaseManager):
obj_cls = License
+class Namespace(GitlabObject):
+ _url = '/namespaces'
+ canGet = 'from_list'
+ canUpdate = False
+ canDelete = False
+ canCreate = False
+ optionalListAttrs = ['search']
+
+
+class NamespaceManager(BaseManager):
+ obj_cls = Namespace
+
+
class ProjectBranch(GitlabObject):
_url = '/projects/%(project_id)s/repository/branches'
_constructorTypes = {'author': 'User', "committer": "User"}
diff --git a/tools/python_test.py b/tools/python_test.py
index d09d24b..c085f62 100644
--- a/tools/python_test.py
+++ b/tools/python_test.py
@@ -234,3 +234,9 @@ admin_project = admin_project.star()
assert(admin_project.star_count == 1)
admin_project = admin_project.unstar()
assert(admin_project.star_count == 0)
+
+# namespaces
+ns = gl.namespaces.list()
+assert(len(ns) != 0)
+ns = gl.namespaces.list(search='root')[0]
+assert(ns.kind == 'user')