FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/tests/unit/objects/test_issues.py at v8.6.0 · python-gitlab/python-gitlab · GitHub
python-gitlab
python-gitlab
Repository navigation
Code
Issues
16
(16)
Pull requests
15
(15)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-gitlab
/
tests
/
unit
/
objects
/
test_issues.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
109 lines (84 loc) · 2.93 KB
Breadcrumbs
python-gitlab
/
tests
/
unit
/
objects
/
test_issues.py
Copy path
File metadata and controls
109 lines (84 loc) · 2.93 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""
GitLab API: https://docs.gitlab.com/ce/api/issues.html
"""
import
re
import
pytest
import
responses
from
gitlab
.
v4
.
objects
import
(
GroupIssuesStatistics
,
IssuesStatistics
,
ProjectIssuesStatistics
,
)
@
pytest
.
fixture
def
resp_list_issues
():
content
=
[{
"name"
:
"name"
,
"id"
:
1
}, {
"name"
:
"other_name"
,
"id"
:
2
}]
with
responses
.
RequestsMock
()
as
rsps
:
rsps
.
add
(
method
=
responses
.
GET
,
url
=
"http://localhost/api/v4/issues"
,
json
=
content
,
content_type
=
"application/json"
,
status
=
200
,
)
yield
rsps
@
pytest
.
fixture
def
resp_get_issue
():
with
responses
.
RequestsMock
()
as
rsps
:
rsps
.
add
(
method
=
responses
.
GET
,
url
=
"http://localhost/api/v4/issues/1"
,
json
=
{
"name"
:
"name"
,
"id"
:
1
},
content_type
=
"application/json"
,
status
=
200
,
)
yield
rsps
@
pytest
.
fixture
def
resp_reorder_issue
():
match_params
=
{
"move_after_id"
:
2
,
"move_before_id"
:
3
}
with
responses
.
RequestsMock
()
as
rsps
:
rsps
.
add
(
method
=
responses
.
PUT
,
url
=
"http://localhost/api/v4/projects/1/issues/1/reorder"
,
json
=
{
"name"
:
"name"
,
"id"
:
1
},
content_type
=
"application/json"
,
status
=
200
,
match
=
[
responses
.
matchers
.
json_params_matcher
(
match_params
)],
)
yield
rsps
@
pytest
.
fixture
def
resp_issue_statistics
():
content
=
{
"statistics"
: {
"counts"
: {
"all"
:
20
,
"closed"
:
5
,
"opened"
:
15
}}}
with
responses
.
RequestsMock
()
as
rsps
:
rsps
.
add
(
method
=
responses
.
GET
,
url
=
re
.
compile
(
r"http://localhost/api/v4/((groups|projects)/1/)?issues_statistics"
),
json
=
content
,
content_type
=
"application/json"
,
status
=
200
,
)
yield
rsps
def
test_list_issues
(
gl
,
resp_list_issues
):
data
=
gl
.
issues
.
list
()
assert
data
[
1
].
id
==
2
assert
data
[
1
].
name
==
"other_name"
def
test_get_issue
(
gl
,
resp_get_issue
):
issue
=
gl
.
issues
.
get
(
1
)
assert
issue
.
id
==
1
assert
issue
.
name
==
"name"
def
test_reorder_issue
(
project
,
resp_reorder_issue
):
issue
=
project
.
issues
.
get
(
1
,
lazy
=
True
)
issue
.
reorder
(
move_after_id
=
2
,
move_before_id
=
3
)
def
test_get_issues_statistics
(
gl
,
resp_issue_statistics
):
statistics
=
gl
.
issues_statistics
.
get
()
assert
isinstance
(
statistics
,
IssuesStatistics
)
assert
statistics
.
statistics
[
"counts"
][
"all"
]
==
20
def
test_get_group_issues_statistics
(
group
,
resp_issue_statistics
):
statistics
=
group
.
issues_statistics
.
get
()
assert
isinstance
(
statistics
,
GroupIssuesStatistics
)
assert
statistics
.
statistics
[
"counts"
][
"all"
]
==
20
def
test_get_project_issues_statistics
(
project
,
resp_issue_statistics
):
statistics
=
project
.
issues_statistics
.
get
()
assert
isinstance
(
statistics
,
ProjectIssuesStatistics
)
assert
statistics
.
statistics
[
"counts"
][
"all"
]
==
20
Back
|
FazBrowse Home
|
New Git URL