FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/tests/unit/objects/test_services.py at v7.1.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_services.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
99 lines (84 loc) · 3.09 KB
Breadcrumbs
python-gitlab
/
tests
/
unit
/
objects
/
test_services.py
Copy path
File metadata and controls
99 lines (84 loc) · 3.09 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
"""
GitLab API: https://docs.gitlab.com/ce/api/integrations.html
"""
import
pytest
import
responses
from
gitlab
.
v4
.
objects
import
ProjectIntegration
,
ProjectService
@
pytest
.
fixture
def
resp_integration
():
content
=
{
"id"
:
100152
,
"title"
:
"Pipelines emails"
,
"slug"
:
"pipelines-email"
,
"created_at"
:
"2019-01-14T08:46:43.637+01:00"
,
"updated_at"
:
"2019-07-01T14:10:36.156+02:00"
,
"active"
:
True
,
"commit_events"
:
True
,
"push_events"
:
True
,
"issues_events"
:
True
,
"confidential_issues_events"
:
True
,
"merge_requests_events"
:
True
,
"tag_push_events"
:
True
,
"note_events"
:
True
,
"confidential_note_events"
:
True
,
"pipeline_events"
:
True
,
"wiki_page_events"
:
True
,
"job_events"
:
True
,
"comment_on_event_enabled"
:
True
,
"project_id"
:
1
,
}
with
responses
.
RequestsMock
(
assert_all_requests_are_fired
=
False
)
as
rsps
:
rsps
.
add
(
method
=
responses
.
GET
,
url
=
"http://localhost/api/v4/projects/1/integrations"
,
json
=
[
content
],
content_type
=
"application/json"
,
status
=
200
,
)
rsps
.
add
(
method
=
responses
.
GET
,
url
=
"http://localhost/api/v4/projects/1/integrations"
,
json
=
content
,
content_type
=
"application/json"
,
status
=
200
,
)
rsps
.
add
(
method
=
responses
.
GET
,
url
=
"http://localhost/api/v4/projects/1/integrations/pipelines-email"
,
json
=
content
,
content_type
=
"application/json"
,
status
=
200
,
)
updated_content
=
dict
(
content
)
updated_content
[
"issues_events"
]
=
False
rsps
.
add
(
method
=
responses
.
PUT
,
url
=
"http://localhost/api/v4/projects/1/integrations/pipelines-email"
,
json
=
updated_content
,
content_type
=
"application/json"
,
status
=
200
,
)
yield
rsps
def
test_list_active_integrations
(
project
,
resp_integration
):
integrations
=
project
.
integrations
.
list
()
assert
isinstance
(
integrations
,
list
)
assert
isinstance
(
integrations
[
0
],
ProjectIntegration
)
assert
integrations
[
0
].
active
assert
integrations
[
0
].
push_events
def
test_list_available_integrations
(
project
,
resp_integration
):
integrations
=
project
.
integrations
.
available
()
assert
isinstance
(
integrations
,
list
)
assert
isinstance
(
integrations
[
0
],
str
)
def
test_get_integration
(
project
,
resp_integration
):
integration
=
project
.
integrations
.
get
(
"pipelines-email"
)
assert
isinstance
(
integration
,
ProjectIntegration
)
assert
integration
.
push_events
is
True
def
test_update_integration
(
project
,
resp_integration
):
integration
=
project
.
integrations
.
get
(
"pipelines-email"
)
integration
.
issues_events
=
False
integration
.
save
()
assert
integration
.
issues_events
is
False
def
test_get_service_returns_service
(
project
,
resp_integration
):
# todo: remove when services are removed
service
=
project
.
services
.
get
(
"pipelines-email"
)
assert
isinstance
(
service
,
ProjectService
)
Back
|
FazBrowse Home
|
New Git URL