blob: b62e5cd3926145bec117d90bf472d25a1623a213 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#!/bin/sh
# Copyright (C) 2015 Gauvain Pocentek <gauvain@pocentek.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
testcase "project creation" '
OUTPUT=$(try GITLAB project create --name test-project1) || exit 1
PROJECT_ID=$(pecho "${OUTPUT}" | grep ^id: | cut -d" " -f2)
OUTPUT=$(try GITLAB project list) || exit 1
pecho "${OUTPUT}" | grep -q test-project1
'
testcase "project update" '
GITLAB project update --id "$PROJECT_ID" --description "My New Description"
'
testcase "user creation" '
OUTPUT=$(GITLAB user create --email fake@email.com --username user1 \
--name "User One" --password fakepassword)
'
USER_ID=$(pecho "${OUTPUT}" | grep ^id: | cut -d' ' -f2)
testcase "user get (by id)" '
GITLAB user get --id $USER_ID >/dev/null 2>&1
'
testcase "verbose output" '
OUTPUT=$(try GITLAB -v user list) || exit 1
pecho "${OUTPUT}" | grep -q avatar-url
'
testcase "CLI args not in output" '
OUTPUT=$(try GITLAB -v user list) || exit 1
pecho "${OUTPUT}" | grep -qv config-file
'
testcase "adding member to a project" '
GITLAB project-member create --project-id "$PROJECT_ID" \
--user-id "$USER_ID" --access-level 40 >/dev/null 2>&1
'
testcase "file creation" '
GITLAB project-file create --project-id "$PROJECT_ID" \
--file-path README --branch master --content "CONTENT" \
--commit-message "Initial commit" >/dev/null 2>&1
'
testcase "issue creation" '
OUTPUT=$(GITLAB project-issue create --project-id "$PROJECT_ID" \
--title "my issue" --description "my issue description")
'
ISSUE_ID=$(pecho "${OUTPUT}" | grep ^iid: | cut -d' ' -f2)
testcase "note creation" '
GITLAB project-issue-note create --project-id "$PROJECT_ID" \
--issue-iid "$ISSUE_ID" --body "the body" >/dev/null 2>&1
'
testcase "branch creation" '
GITLAB project-branch create --project-id "$PROJECT_ID" \
--branch branch1 --ref master >/dev/null 2>&1
'
GITLAB project-file create --project-id "$PROJECT_ID" \
--file-path README2 --branch branch1 --content "CONTENT" \
--commit-message "second commit" >/dev/null 2>&1
testcase "merge request creation" '
OUTPUT=$(GITLAB project-merge-request create \
--project-id "$PROJECT_ID" \
--source-branch branch1 --target-branch master \
--title "Update README")
'
MR_ID=$(pecho "${OUTPUT}" | grep ^iid: | cut -d' ' -f2)
testcase "merge request validation" '
GITLAB project-merge-request merge --project-id "$PROJECT_ID" \
--iid "$MR_ID" >/dev/null 2>&1
'
testcase "branch deletion" '
GITLAB project-branch delete --project-id "$PROJECT_ID" \
--name branch1 >/dev/null 2>&1
'
testcase "project upload" '
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 >/dev/null 2>&1
'
cat > /tmp/gitlab-project-description << EOF
Multi line
Data
EOF
testcase "values from files" '
OUTPUT=$(GITLAB -v project create --name fromfile \
--description @/tmp/gitlab-project-description)
echo $OUTPUT | grep -q "Multi line"
'
|