forked from DataDog/integrations-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
225 lines (174 loc) · 4.77 KB
/
conftest.py
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import json
import os
import pytest
from .constants import HERE
@pytest.fixture(scope='session')
def dd_environment():
yield
@pytest.fixture
def instance():
return {
"api_url": "https://api.sys.domain.com",
"client_id": "client_id",
"client_secret": "client_secret",
"tags": ["foo:bar"],
"event_filter": ["audit1", "audit2"],
"results_per_page": 45,
}
@pytest.fixture
def instance_defaults():
return {
"api_url": "https://api.sys.domain.com",
"client_id": "client_id",
"client_secret": "client_secret",
}
@pytest.fixture()
def events_v3_p0():
"""
Returns raw events from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'events_v3_p0.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def events_v3_p1():
"""
Returns raw events from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'events_v3_p1.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def events_v3_p2():
"""
Returns raw events from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'events_v3_p2.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def orgs_v2_p1():
"""
Returns raw orgs from API v2
"""
with open(os.path.join(HERE, 'fixtures', 'orgs_v2_p1.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def orgs_v2_p2():
"""
Returns raw orgs from API v2
"""
with open(os.path.join(HERE, 'fixtures', 'orgs_v2_p2.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def orgs_v3_p1():
"""
Returns raw orgs from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'orgs_v3_p1.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def orgs_v3_p2():
"""
Returns raw orgs from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'orgs_v3_p2.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def spaces_v2_p1():
"""
Returns raw spaces from API v2
"""
with open(os.path.join(HERE, 'fixtures', 'spaces_v2_p1.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def spaces_v2_p2():
"""
Returns raw spaces from API v2
"""
with open(os.path.join(HERE, 'fixtures', 'spaces_v2_p2.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def spaces_v3_p1():
"""
Returns raw spaces from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'spaces_v3_p1.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def spaces_v3_p2():
"""
Returns raw spaces from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'spaces_v3_p2.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def space_v3():
"""
Returns raw space from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'space_v3.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def space_v2():
"""
Returns raw space from API v2
"""
with open(os.path.join(HERE, 'fixtures', 'space_v2.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def org_v3():
"""
Returns raw org from API v3
"""
with open(os.path.join(HERE, 'fixtures', 'org_v3.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def org_v2():
"""
Returns raw org from API v2
"""
with open(os.path.join(HERE, 'fixtures', 'org_v2.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def dd_events():
"""
Returns a dict of formatted events ready to send to Datadog
"""
with open(os.path.join(HERE, 'fixtures', 'dd_events.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def oauth_token():
"""
Returns the response from the UAA with the oauth_token
"""
with open(os.path.join(HERE, 'fixtures', 'oauth_token.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def event_v2():
"""
Returns a single v2 event
"""
with open(os.path.join(HERE, 'fixtures', 'event_v2.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def event_v3():
"""
Returns a single v3 event
"""
with open(os.path.join(HERE, 'fixtures', 'event_v3.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def api_info_v3():
"""
Returns API info with recent enough v3
"""
with open(os.path.join(HERE, 'fixtures', 'api_info_v3.json')) as f:
return json.loads(f.read())
@pytest.fixture()
def api_info_v2():
"""
Returns API info without recent enough v3
"""
with open(os.path.join(HERE, 'fixtures', 'api_info_v2.json')) as f:
return json.loads(f.read())