summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gitlab/mixins.py2
-rw-r--r--gitlab/v4/cli.py19
-rw-r--r--tools/cli_test_v4.sh11
3 files changed, 23 insertions, 9 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py
index 2acc54b..d017152 100644
--- a/gitlab/mixins.py
+++ b/gitlab/mixins.py
@@ -51,7 +51,7 @@ class GetMixin(object):
class GetWithoutIdMixin(object):
@exc.on_http_error(exc.GitlabGetError)
- def get(self, **kwargs):
+ def get(self, id=None, **kwargs):
"""Retrieve a single object.
Args:
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index 6e664b3..939a7cc 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -83,7 +83,7 @@ class GitlabCLI(object):
def do_get(self):
id = None
- if gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(self.cls):
+ if gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(self.mgr_cls):
id = self.args.pop(self.cls._id_attr)
try:
@@ -99,7 +99,9 @@ class GitlabCLI(object):
cli.die("Impossible to destroy object", e)
def do_update(self):
- id = self.args.pop(self.cls._id_attr)
+ id = None
+ if gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(self.mgr_cls):
+ id = self.args.pop(self.cls._id_attr)
try:
return self.mgr.update(id, self.args)
except Exception as e:
@@ -282,15 +284,18 @@ class LegacyPrinter(object):
return
# not a dict, we assume it's a RESTObject
- id = getattr(obj, obj._id_attr, None)
- print('%s: %s' % (obj._id_attr, id))
+ if obj._id_attr:
+ id = getattr(obj, obj._id_attr, None)
+ print('%s: %s' % (obj._id_attr, id))
attrs = obj.attributes
- attrs.pop(obj._id_attr)
+ if obj._id_attr:
+ attrs.pop(obj._id_attr)
display_dict(attrs, padding)
else:
- id = getattr(obj, obj._id_attr)
- print('%s: %s' % (obj._id_attr.replace('_', '-'), id))
+ if obj._id_attr:
+ id = getattr(obj, obj._id_attr)
+ print('%s: %s' % (obj._id_attr.replace('_', '-'), id))
if hasattr(obj, '_short_print_attr'):
value = getattr(obj, obj._short_print_attr)
print('%s: %s' % (obj._short_print_attr, value))
diff --git a/tools/cli_test_v4.sh b/tools/cli_test_v4.sh
index 813d85b..01f84e8 100644
--- a/tools/cli_test_v4.sh
+++ b/tools/cli_test_v4.sh
@@ -95,9 +95,18 @@ testcase "branch deletion" '
'
testcase "project upload" '
- GITLAB project upload --id "$PROJECT_ID" --filename '$(basename $0)' --filepath '$0'
+ GITLAB project upload --id "$PROJECT_ID" \
+ --filename '$(basename $0)' --filepath '$0' >/dev/null 2>&1
'
testcase "project deletion" '
GITLAB project delete --id "$PROJECT_ID"
'
+
+testcase "application settings get" '
+ GITLAB application-settings get >/dev/null 2>&1
+'
+
+testcase "application settings update" '
+ GITLAB application-settings update --signup-enabled false
+'