From b7662039d191ebb6a4061c276e78999e2da7cd3f Mon Sep 17 00:00:00 2001 From: nateatkins Date: Sun, 25 Nov 2018 12:05:27 -0700 Subject: [PATCH] fix(cli): fix update value for key not working --- gitlab/mixins.py | 2 ++ tools/cli_test_v4.sh | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) mode change 100644 => 100755 tools/cli_test_v4.sh diff --git a/gitlab/mixins.py b/gitlab/mixins.py index b1309f6ba..7cbb7b9f9 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -208,6 +208,8 @@ def create(self, data, **kwargs): class UpdateMixin(object): def _check_missing_update_attrs(self, data): required, optional = self.get_update_attrs() + # Remove the id field from the required list as it was previously moved to the http path. + required = tuple(filter(lambda k: k != self._obj_cls._id_attr, required)) missing = [] for attr in required: if attr not in data: diff --git a/tools/cli_test_v4.sh b/tools/cli_test_v4.sh old mode 100644 new mode 100755 index b62e5cd39..dea0509eb --- a/tools/cli_test_v4.sh +++ b/tools/cli_test_v4.sh @@ -89,6 +89,31 @@ testcase "merge request validation" ' --iid "$MR_ID" >/dev/null 2>&1 ' +# Test project variables +testcase "create project variable" ' + OUTPUT=$(GITLAB -v project-variable create --project-id $PROJECT_ID \ + --key junk --value car) +' + +testcase "get project variable" ' + OUTPUT=$(GITLAB -v project-variable get --project-id $PROJECT_ID \ + --key junk) +' + +testcase "update project variable" ' + OUTPUT=$(GITLAB -v project-variable update --project-id $PROJECT_ID \ + --key junk --value bus) +' + +testcase "list project variable" ' + OUTPUT=$(GITLAB -v project-variable list --project-id $PROJECT_ID) +' + +testcase "delete project variable" ' + OUTPUT=$(GITLAB -v project-variable delete --project-id $PROJECT_ID \ + --key junk) +' + testcase "branch deletion" ' GITLAB project-branch delete --project-id "$PROJECT_ID" \ --name branch1 >/dev/null 2>&1