Skip to content

Commit 330e149

Browse files
committed
test: add tests for label resource and data source
1 parent 082fb85 commit 330e149

7 files changed

Lines changed: 409 additions & 13 deletions

File tree

examples/data-sources/okta_label/datasource.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
2-
# Create-then-read pattern (resource exists)
31
resource "okta_label" "test" {
4-
label_id = "replace_with_uuid"
5-
name = "test-name"
2+
name = "test-label-replace_with_uuid"
3+
4+
values {
5+
name = "test-value"
6+
}
67
}
78

89
data "okta_label" "test" {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
resource "okta_label" "test" {
2-
label_id = "replace_with_uuid"
3-
name = "test-name"
2+
name = "test-label-replace_with_uuid"
3+
44
values {
5-
name = "test-name"
5+
name = "test-value"
66
}
77
}

okta/services/governance/data_source_okta_label_generated_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

okta/services/governance/data_source_okta_resource_label_generated_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

okta/services/governance/resource_okta_label_generated_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
---
2+
version: 2
3+
interactions:
4+
- id: 0
5+
request:
6+
proto: HTTP/1.1
7+
proto_major: 1
8+
proto_minor: 1
9+
content_length: 66
10+
host: oie-00.dne-okta.com
11+
body: |
12+
{"name":"test-label-1985594213","values":[{"name":"test-value"}]}
13+
headers:
14+
Accept:
15+
- application/json
16+
Authorization:
17+
- SSWS REDACTED
18+
Content-Type:
19+
- application/json
20+
url: https://oie-00.dne-okta.com/governance/api/v1/labels
21+
method: POST
22+
response:
23+
proto: HTTP/2.0
24+
proto_major: 2
25+
proto_minor: 0
26+
content_length: 273
27+
body: '{"labelId":"lbc1e0eg6gEcT7fSO1d7","name":"test-label-1985594213","values":[{"labelValueId":"lbl1e0eg6hH2omaQg1d7","name":"test-value"}],"_links":{"self":{"href":"https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7","hints":{}}}}'
28+
headers:
29+
Accept-Ch:
30+
- Sec-CH-UA-Platform-Version
31+
Content-Length:
32+
- "273"
33+
Content-Type:
34+
- application/json
35+
Date:
36+
- Thu, 25 Jun 2026 05:06:20 GMT
37+
Link:
38+
- <https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7>; rel="self"
39+
Location:
40+
- https://dcp-testing-oig-2025-06-26.oktapreview.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7
41+
Referrer-Policy:
42+
- strict-origin-when-cross-origin
43+
status: 201 Created
44+
code: 201
45+
duration: 1.358548708s
46+
- id: 1
47+
request:
48+
proto: HTTP/1.1
49+
proto_major: 1
50+
proto_minor: 1
51+
content_length: 0
52+
host: oie-00.dne-okta.com
53+
headers:
54+
Accept:
55+
- application/json
56+
Authorization:
57+
- SSWS REDACTED
58+
url: https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7
59+
method: GET
60+
response:
61+
proto: HTTP/2.0
62+
proto_major: 2
63+
proto_minor: 0
64+
content_length: -1
65+
uncompressed: true
66+
body: '{"labelId":"lbc1e0eg6gEcT7fSO1d7","name":"test-label-1985594213","values":[{"labelValueId":"lbl1e0eg6hH2omaQg1d7","name":"test-value"}],"_links":{"self":{"href":"https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7","hints":{}}}}'
67+
headers:
68+
Accept-Ch:
69+
- Sec-CH-UA-Platform-Version
70+
Content-Type:
71+
- application/json
72+
Date:
73+
- Thu, 25 Jun 2026 05:06:21 GMT
74+
Link:
75+
- <https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7>; rel="self"
76+
Referrer-Policy:
77+
- strict-origin-when-cross-origin
78+
status: 200 OK
79+
code: 200
80+
duration: 1.153725125s
81+
- id: 2
82+
request:
83+
proto: HTTP/1.1
84+
proto_major: 1
85+
proto_minor: 1
86+
content_length: 0
87+
host: oie-00.dne-okta.com
88+
headers:
89+
Accept:
90+
- application/json
91+
Authorization:
92+
- SSWS REDACTED
93+
url: https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7
94+
method: GET
95+
response:
96+
proto: HTTP/2.0
97+
proto_major: 2
98+
proto_minor: 0
99+
content_length: -1
100+
uncompressed: true
101+
body: '{"labelId":"lbc1e0eg6gEcT7fSO1d7","name":"test-label-1985594213","values":[{"labelValueId":"lbl1e0eg6hH2omaQg1d7","name":"test-value"}],"_links":{"self":{"href":"https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7","hints":{}}}}'
102+
headers:
103+
Accept-Ch:
104+
- Sec-CH-UA-Platform-Version
105+
Content-Type:
106+
- application/json
107+
Date:
108+
- Thu, 25 Jun 2026 05:06:23 GMT
109+
Link:
110+
- <https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7>; rel="self"
111+
Referrer-Policy:
112+
- strict-origin-when-cross-origin
113+
status: 200 OK
114+
code: 200
115+
duration: 1.146429833s
116+
- id: 3
117+
request:
118+
proto: HTTP/1.1
119+
proto_major: 1
120+
proto_minor: 1
121+
content_length: 0
122+
host: oie-00.dne-okta.com
123+
headers:
124+
Accept:
125+
- application/json
126+
Authorization:
127+
- SSWS REDACTED
128+
url: https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7
129+
method: GET
130+
response:
131+
proto: HTTP/2.0
132+
proto_major: 2
133+
proto_minor: 0
134+
content_length: -1
135+
uncompressed: true
136+
body: '{"labelId":"lbc1e0eg6gEcT7fSO1d7","name":"test-label-1985594213","values":[{"labelValueId":"lbl1e0eg6hH2omaQg1d7","name":"test-value"}],"_links":{"self":{"href":"https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7","hints":{}}}}'
137+
headers:
138+
Accept-Ch:
139+
- Sec-CH-UA-Platform-Version
140+
Content-Type:
141+
- application/json
142+
Date:
143+
- Thu, 25 Jun 2026 05:06:24 GMT
144+
Link:
145+
- <https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7>; rel="self"
146+
Referrer-Policy:
147+
- strict-origin-when-cross-origin
148+
status: 200 OK
149+
code: 200
150+
duration: 1.129298333s
151+
- id: 4
152+
request:
153+
proto: HTTP/1.1
154+
proto_major: 1
155+
proto_minor: 1
156+
content_length: 0
157+
host: oie-00.dne-okta.com
158+
headers:
159+
Accept:
160+
- application/json
161+
Authorization:
162+
- SSWS REDACTED
163+
url: https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7
164+
method: GET
165+
response:
166+
proto: HTTP/2.0
167+
proto_major: 2
168+
proto_minor: 0
169+
content_length: -1
170+
uncompressed: true
171+
body: '{"labelId":"lbc1e0eg6gEcT7fSO1d7","name":"test-label-1985594213","values":[{"labelValueId":"lbl1e0eg6hH2omaQg1d7","name":"test-value"}],"_links":{"self":{"href":"https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7","hints":{}}}}'
172+
headers:
173+
Accept-Ch:
174+
- Sec-CH-UA-Platform-Version
175+
Content-Type:
176+
- application/json
177+
Date:
178+
- Thu, 25 Jun 2026 05:06:25 GMT
179+
Link:
180+
- <https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7>; rel="self"
181+
Referrer-Policy:
182+
- strict-origin-when-cross-origin
183+
status: 200 OK
184+
code: 200
185+
duration: 1.135973542s
186+
- id: 5
187+
request:
188+
proto: HTTP/1.1
189+
proto_major: 1
190+
proto_minor: 1
191+
content_length: 0
192+
host: oie-00.dne-okta.com
193+
headers:
194+
Accept:
195+
- application/json
196+
Authorization:
197+
- SSWS REDACTED
198+
url: https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7
199+
method: GET
200+
response:
201+
proto: HTTP/2.0
202+
proto_major: 2
203+
proto_minor: 0
204+
content_length: -1
205+
uncompressed: true
206+
body: '{"labelId":"lbc1e0eg6gEcT7fSO1d7","name":"test-label-1985594213","values":[{"labelValueId":"lbl1e0eg6hH2omaQg1d7","name":"test-value"}],"_links":{"self":{"href":"https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7","hints":{}}}}'
207+
headers:
208+
Accept-Ch:
209+
- Sec-CH-UA-Platform-Version
210+
Content-Type:
211+
- application/json
212+
Date:
213+
- Thu, 25 Jun 2026 05:06:26 GMT
214+
Link:
215+
- <https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7>; rel="self"
216+
Referrer-Policy:
217+
- strict-origin-when-cross-origin
218+
status: 200 OK
219+
code: 200
220+
duration: 1.137022167s
221+
- id: 6
222+
request:
223+
proto: HTTP/1.1
224+
proto_major: 1
225+
proto_minor: 1
226+
content_length: 0
227+
host: oie-00.dne-okta.com
228+
headers:
229+
Accept:
230+
- application/json
231+
Authorization:
232+
- SSWS REDACTED
233+
url: https://oie-00.dne-okta.com/governance/api/v1/labels/lbc1e0eg6gEcT7fSO1d7
234+
method: DELETE
235+
response:
236+
proto: HTTP/2.0
237+
proto_major: 2
238+
proto_minor: 0
239+
content_length: 0
240+
body: ""
241+
headers:
242+
Accept-Ch:
243+
- Sec-CH-UA-Platform-Version
244+
Date:
245+
- Thu, 25 Jun 2026 05:06:28 GMT
246+
Referrer-Policy:
247+
- strict-origin-when-cross-origin
248+
status: 204 No Content
249+
code: 204
250+
duration: 1.153303125s

0 commit comments

Comments
 (0)