Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Managetests
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Managetests
Commits
b9d93919
Commit
b9d93919
authored
Feb 09, 2019
by
Pietro Albini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate to gitlab api v4
parent
b7467053
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
managetests/app.py
managetests/app.py
+3
-3
managetests/branches.py
managetests/branches.py
+4
-4
managetests/gitlab.py
managetests/gitlab.py
+3
-3
No files found.
managetests/app.py
View file @
b9d93919
...
@@ -77,8 +77,8 @@ class TestsManager:
...
@@ -77,8 +77,8 @@ class TestsManager:
if
new
is
None
:
if
new
is
None
:
raise
RuntimeError
(
"Can't get merge requests from GitLab!"
)
raise
RuntimeError
(
"Can't get merge requests from GitLab!"
)
for
request
in
new
:
for
request
in
new
:
add
(
request
[
"source_branch"
],
request
[
"id"
])
add
(
request
[
"source_branch"
],
request
[
"i
i
d"
])
self
.
details
[
"branches"
][
name
]
=
request
[
"
id"
]
self
.
details
[
"branches"
][
request
[
"source_branch"
]]
=
request
[
"i
id"
]
self
.
save_details
()
self
.
save_details
()
...
@@ -178,7 +178,7 @@ class TestsManager:
...
@@ -178,7 +178,7 @@ class TestsManager:
# The instance should be created
# The instance should be created
elif
branch
not
in
self
.
branches
and
obj
[
"state"
]
==
"opened"
:
elif
branch
not
in
self
.
branches
and
obj
[
"state"
]
==
"opened"
:
self
.
branches
[
branch
]
=
branches
.
Branch
(
self
,
branch
,
obj
[
"id"
])
self
.
branches
[
branch
]
=
branches
.
Branch
(
self
,
branch
,
obj
[
"i
i
d"
])
self
.
branches
[
branch
].
deploy
()
self
.
branches
[
branch
].
deploy
()
self
.
instances
.
load_branch
(
self
.
branches
[
branch
])
self
.
instances
.
load_branch
(
self
.
branches
[
branch
])
...
...
managetests/branches.py
View file @
b9d93919
...
@@ -31,8 +31,8 @@ class Branch:
...
@@ -31,8 +31,8 @@ class Branch:
self
.
manager
=
manager
self
.
manager
=
manager
self
.
name
=
name
self
.
name
=
name
self
.
mr
=
merge_request
self
.
mr
=
None
self
.
mr_id
=
None
self
.
mr_id
=
merge_request
self
.
mr_url
=
None
self
.
mr_url
=
None
self
.
author
=
None
self
.
author
=
None
self
.
author_url
=
None
self
.
author_url
=
None
...
@@ -53,13 +53,13 @@ class Branch:
...
@@ -53,13 +53,13 @@ class Branch:
self
.
active
=
True
self
.
active
=
True
return
return
result
=
self
.
manager
.
gitlab
.
merge_request
(
self
.
mr
)
result
=
self
.
manager
.
gitlab
.
merge_request
(
self
.
mr
_id
)
if
result
:
if
result
:
active
=
result
[
"state"
]
==
"opened"
active
=
result
[
"state"
]
==
"opened"
else
:
else
:
active
=
False
active
=
False
self
.
active
=
active
self
.
active
=
active
self
.
mr
_id
=
result
[
"i
id"
]
self
.
mr
=
result
[
"
id"
]
self
.
mr_url
=
(
self
.
manager
.
config
[
"gitlab-url"
]
+
"/"
+
self
.
mr_url
=
(
self
.
manager
.
config
[
"gitlab-url"
]
+
"/"
+
self
.
manager
.
config
[
"gitlab-project"
]
+
self
.
manager
.
config
[
"gitlab-project"
]
+
"/merge_requests/"
+
str
(
self
.
mr_id
))
"/merge_requests/"
+
str
(
self
.
mr_id
))
...
...
managetests/gitlab.py
View file @
b9d93919
...
@@ -34,7 +34,7 @@ class GitLabAPI:
...
@@ -34,7 +34,7 @@ class GitLabAPI:
if
data
is
None
:
if
data
is
None
:
data
=
{}
data
=
{}
url
=
self
.
url
+
"/api/v
3
/"
+
endpoint
url
=
self
.
url
+
"/api/v
4
/"
+
endpoint
params
[
"private_token"
]
=
self
.
token
params
[
"private_token"
]
=
self
.
token
response
=
requests
.
request
(
method
,
url
,
params
=
params
,
data
=
data
)
response
=
requests
.
request
(
method
,
url
,
params
=
params
,
data
=
data
)
...
@@ -59,12 +59,12 @@ class GitLabAPI:
...
@@ -59,12 +59,12 @@ class GitLabAPI:
def
merge_request
(
self
,
id
):
def
merge_request
(
self
,
id
):
"""Get a single merge request on the project"""
"""Get a single merge request on the project"""
return
self
.
call
(
"get"
,
"projects/%s/merge_request/%s"
%
(
return
self
.
call
(
"get"
,
"projects/%s/merge_request
s
/%s"
%
(
self
.
project
,
id
))
self
.
project
,
id
))
def
post_comment
(
self
,
id
,
text
):
def
post_comment
(
self
,
id
,
text
):
"""Post a comment on a merge request"""
"""Post a comment on a merge request"""
return
self
.
call
(
"post"
,
"projects/%s/merge_request/%s/comments"
%
(
return
self
.
call
(
"post"
,
"projects/%s/merge_request
s
/%s/comments"
%
(
self
.
project
,
id
),
data
=
{
"note"
:
text
})
self
.
project
,
id
),
data
=
{
"note"
:
text
})
def
commit_status
(
self
,
commit
,
state
,
ref
,
url
=
None
):
def
commit_status
(
self
,
commit
,
state
,
ref
,
url
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment