File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 191
191
expect ( response . body ) . to include ( "Boomtown error occurred" )
192
192
end
193
193
end
194
+
195
+ describe "okta setup" do
196
+ it "sends a POST request to the /webhooks/okta_webhook_setup endpoint and it fails because it is not a GET" do
197
+ payload = { } . to_json
198
+ headers = { }
199
+ response = http . post ( "/webhooks/okta_webhook_setup" , payload , headers )
200
+
201
+ expect ( response ) . to be_a ( Net ::HTTPMethodNotAllowed )
202
+ expect ( response . body ) . to include ( "405 Not Allowed" )
203
+ end
204
+
205
+ it "sends a GET request to the /webhooks/okta_webhook_setup endpoint and it returns the verification challenge" do
206
+ headers = { "x-okta-verification-challenge" => "test-challenge" }
207
+ response = http . get ( "/webhooks/okta_webhook_setup" , headers )
208
+
209
+ expect ( response ) . to be_a ( Net ::HTTPSuccess )
210
+ body = JSON . parse ( response . body )
211
+ expect ( body [ "verification" ] ) . to eq ( "test-challenge" )
212
+ end
213
+
214
+ it "sends a GET request to the /webhooks/okta_webhook_setup endpoint but it is missing the verification challenge header" do
215
+ response = http . get ( "/webhooks/okta_webhook_setup" )
216
+
217
+ expect ( response ) . to be_a ( Net ::HTTPSuccess )
218
+ expect ( response . code ) . to eq ( "200" )
219
+ body = JSON . parse ( response . body )
220
+ expect ( body [ "error" ] ) . to eq ( "Missing verification challenge header" )
221
+ expect ( body [ "expected_header" ] ) . to eq ( "x-okta-verification-challenge" )
222
+ end
223
+ end
194
224
end
195
225
end
You can’t perform that action at this time.
0 commit comments