scimitar 1.6.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -0
- data/README.md +671 -0
- data/app/controllers/scimitar/active_record_backed_resources_controller.rb +22 -4
- data/app/controllers/scimitar/application_controller.rb +7 -2
- data/app/controllers/scimitar/schemas_controller.rb +5 -0
- data/app/models/scimitar/errors.rb +1 -1
- data/app/models/scimitar/resources/base.rb +12 -2
- data/app/models/scimitar/schema/attribute.rb +15 -6
- data/app/models/scimitar/schema/base.rb +4 -2
- data/config/initializers/scimitar.rb +8 -3
- data/lib/scimitar/version.rb +2 -2
- data/spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb +24 -0
- data/spec/apps/dummy/app/models/mock_user.rb +4 -0
- data/spec/apps/dummy/config/initializers/scimitar.rb +8 -0
- data/spec/apps/dummy/config/routes.rb +5 -0
- data/spec/apps/dummy/db/migrate/20210304014602_create_mock_users.rb +1 -0
- data/spec/apps/dummy/db/schema.rb +3 -2
- data/spec/controllers/scimitar/application_controller_spec.rb +2 -2
- data/spec/controllers/scimitar/resource_types_controller_spec.rb +2 -2
- data/spec/controllers/scimitar/schemas_controller_spec.rb +8 -0
- data/spec/models/scimitar/lists/query_parser_spec.rb +1 -1
- data/spec/models/scimitar/resources/base_spec.rb +38 -4
- data/spec/models/scimitar/resources/mixin_spec.rb +4 -1
- data/spec/models/scimitar/resources/user_spec.rb +4 -4
- data/spec/models/scimitar/schema/attribute_spec.rb +22 -0
- data/spec/requests/active_record_backed_resources_controller_spec.rb +127 -37
- data/spec/requests/application_controller_spec.rb +1 -2
- metadata +7 -3
@@ -5,8 +5,6 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
5
5
|
before :each do
|
6
6
|
allow_any_instance_of(Scimitar::ApplicationController).to receive(:authenticated?).and_return(true)
|
7
7
|
|
8
|
-
lmt = Time.parse("2023-01-09 14:25:00 +1300")
|
9
|
-
|
10
8
|
# If a sort order is unspecified, the controller defaults to ID ascending.
|
11
9
|
# With UUID based IDs, testing life is made easier by ensuring that the
|
12
10
|
# creation order matches an ascending UUID sort order (which is what would
|
@@ -28,13 +26,17 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
28
26
|
|
29
27
|
context '#index' do
|
30
28
|
context 'with no items' do
|
31
|
-
|
29
|
+
before :each do
|
32
30
|
MockUser.delete_all
|
31
|
+
end
|
33
32
|
|
33
|
+
it 'returns empty list' do
|
34
34
|
expect_any_instance_of(MockUsersController).to receive(:index).once.and_call_original
|
35
35
|
get '/Users', params: { format: :scim }
|
36
36
|
|
37
|
-
expect(response.status).to eql(200)
|
37
|
+
expect(response.status ).to eql(200)
|
38
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
39
|
+
|
38
40
|
result = JSON.parse(response.body)
|
39
41
|
|
40
42
|
expect(result['totalResults']).to eql(0)
|
@@ -48,7 +50,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
48
50
|
it 'returns all items' do
|
49
51
|
get '/Users', params: { format: :scim }
|
50
52
|
|
51
|
-
expect(response.status).to eql(200)
|
53
|
+
expect(response.status ).to eql(200)
|
54
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
55
|
+
|
52
56
|
result = JSON.parse(response.body)
|
53
57
|
|
54
58
|
expect(result['totalResults']).to eql(3)
|
@@ -66,7 +70,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
66
70
|
it 'returns all items' do
|
67
71
|
get '/Groups', params: { format: :scim }
|
68
72
|
|
69
|
-
expect(response.status).to eql(200)
|
73
|
+
expect(response.status ).to eql(200)
|
74
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
75
|
+
|
70
76
|
result = JSON.parse(response.body)
|
71
77
|
|
72
78
|
expect(result['totalResults']).to eql(3)
|
@@ -86,7 +92,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
86
92
|
filter: 'name.givenName eq "FOO" and name.familyName pr and emails ne "home_1@test.com"'
|
87
93
|
}
|
88
94
|
|
89
|
-
expect(response.status).to eql(200)
|
95
|
+
expect(response.status ).to eql(200)
|
96
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
97
|
+
|
90
98
|
result = JSON.parse(response.body)
|
91
99
|
|
92
100
|
expect(result['totalResults']).to eql(1)
|
@@ -105,7 +113,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
105
113
|
filter: 'name.GIVENNAME eq "Foo" and name.Familyname pr and emails ne "home_1@test.com"'
|
106
114
|
}
|
107
115
|
|
108
|
-
expect(response.status).to eql(200)
|
116
|
+
expect(response.status ).to eql(200)
|
117
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
118
|
+
|
109
119
|
result = JSON.parse(response.body)
|
110
120
|
|
111
121
|
expect(result['totalResults']).to eql(1)
|
@@ -128,7 +138,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
128
138
|
filter: "id eq \"#{@u3.primary_key}\""
|
129
139
|
}
|
130
140
|
|
131
|
-
expect(response.status).to eql(200)
|
141
|
+
expect(response.status ).to eql(200)
|
142
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
143
|
+
|
132
144
|
result = JSON.parse(response.body)
|
133
145
|
|
134
146
|
expect(result['totalResults']).to eql(1)
|
@@ -147,7 +159,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
147
159
|
filter: "externalID eq \"#{@u2.scim_uid}\""
|
148
160
|
}
|
149
161
|
|
150
|
-
expect(response.status).to eql(200)
|
162
|
+
expect(response.status ).to eql(200)
|
163
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
164
|
+
|
151
165
|
result = JSON.parse(response.body)
|
152
166
|
|
153
167
|
expect(result['totalResults']).to eql(1)
|
@@ -166,7 +180,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
166
180
|
filter: "Meta.LastModified eq \"#{@u3.updated_at}\""
|
167
181
|
}
|
168
182
|
|
169
|
-
expect(response.status).to eql(200)
|
183
|
+
expect(response.status ).to eql(200)
|
184
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
185
|
+
|
170
186
|
result = JSON.parse(response.body)
|
171
187
|
|
172
188
|
expect(result['totalResults']).to eql(1)
|
@@ -186,7 +202,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
186
202
|
count: 2
|
187
203
|
}
|
188
204
|
|
189
|
-
expect(response.status).to eql(200)
|
205
|
+
expect(response.status ).to eql(200)
|
206
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
207
|
+
|
190
208
|
result = JSON.parse(response.body)
|
191
209
|
|
192
210
|
expect(result['totalResults']).to eql(3)
|
@@ -205,7 +223,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
205
223
|
startIndex: 2
|
206
224
|
}
|
207
225
|
|
208
|
-
expect(response.status).to eql(200)
|
226
|
+
expect(response.status ).to eql(200)
|
227
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
228
|
+
|
209
229
|
result = JSON.parse(response.body)
|
210
230
|
|
211
231
|
expect(result['totalResults']).to eql(3)
|
@@ -226,8 +246,11 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
226
246
|
filter: 'name.givenName'
|
227
247
|
}
|
228
248
|
|
229
|
-
expect(response.status).to eql(400)
|
249
|
+
expect(response.status ).to eql(400)
|
250
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
251
|
+
|
230
252
|
result = JSON.parse(response.body)
|
253
|
+
|
231
254
|
expect(result['scimType']).to eql('invalidFilter')
|
232
255
|
end
|
233
256
|
end # "context 'with bad calls' do"
|
@@ -241,7 +264,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
241
264
|
expect_any_instance_of(MockUsersController).to receive(:show).once.and_call_original
|
242
265
|
get "/Users/#{@u2.primary_key}", params: { format: :scim }
|
243
266
|
|
244
|
-
expect(response.status).to eql(200)
|
267
|
+
expect(response.status ).to eql(200)
|
268
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
269
|
+
|
245
270
|
result = JSON.parse(response.body)
|
246
271
|
|
247
272
|
expect(result['id']).to eql(@u2.primary_key.to_s)
|
@@ -256,7 +281,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
256
281
|
expect_any_instance_of(MockGroupsController).to receive(:show).once.and_call_original
|
257
282
|
get "/Groups/#{@g2.id}", params: { format: :scim }
|
258
283
|
|
259
|
-
expect(response.status).to eql(200)
|
284
|
+
expect(response.status ).to eql(200)
|
285
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
286
|
+
|
260
287
|
result = JSON.parse(response.body)
|
261
288
|
|
262
289
|
expect(result['id']).to eql(@g2.id.to_s) # Note - ID was converted String; not Integer
|
@@ -268,8 +295,11 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
268
295
|
it 'renders 404' do
|
269
296
|
get '/Users/xyz', params: { format: :scim }
|
270
297
|
|
271
|
-
expect(response.status).to eql(404)
|
298
|
+
expect(response.status ).to eql(404)
|
299
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
300
|
+
|
272
301
|
result = JSON.parse(response.body)
|
302
|
+
|
273
303
|
expect(result['status']).to eql('404')
|
274
304
|
end
|
275
305
|
end # "context '#show' do"
|
@@ -282,7 +312,7 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
282
312
|
it 'with minimal parameters' do
|
283
313
|
mock_before = MockUser.all.to_a
|
284
314
|
|
285
|
-
attributes = { userName: '4' }
|
315
|
+
attributes = { userName: '4' } # Minimum required by schema
|
286
316
|
attributes = spec_helper_hupcase(attributes) if force_upper_case
|
287
317
|
|
288
318
|
expect_any_instance_of(MockUsersController).to receive(:create).once.and_call_original
|
@@ -293,7 +323,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
293
323
|
mock_after = MockUser.all.to_a
|
294
324
|
new_mock = (mock_after - mock_before).first
|
295
325
|
|
296
|
-
expect(response.status).to eql(201)
|
326
|
+
expect(response.status ).to eql(201)
|
327
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
328
|
+
|
297
329
|
result = JSON.parse(response.body)
|
298
330
|
|
299
331
|
expect(result['id']).to eql(new_mock.primary_key.to_s)
|
@@ -334,10 +366,12 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
334
366
|
mock_after = MockUser.all.to_a
|
335
367
|
new_mock = (mock_after - mock_before).first
|
336
368
|
|
337
|
-
expect(response.status).to eql(201)
|
369
|
+
expect(response.status ).to eql(201)
|
370
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
371
|
+
|
338
372
|
result = JSON.parse(response.body)
|
339
373
|
|
340
|
-
expect(result['id']).to eql(new_mock.
|
374
|
+
expect(result['id']).to eql(new_mock.id.to_s)
|
341
375
|
expect(result['meta']['resourceType']).to eql('User')
|
342
376
|
expect(new_mock.username).to eql('4')
|
343
377
|
expect(new_mock.first_name).to eql('Given')
|
@@ -365,8 +399,11 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
365
399
|
}
|
366
400
|
}.to_not change { MockUser.count }
|
367
401
|
|
368
|
-
expect(response.status).to eql(409)
|
402
|
+
expect(response.status ).to eql(409)
|
403
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
404
|
+
|
369
405
|
result = JSON.parse(response.body)
|
406
|
+
|
370
407
|
expect(result['scimType']).to eql('uniqueness')
|
371
408
|
expect(result['detail']).to include('already been taken')
|
372
409
|
end
|
@@ -379,8 +416,11 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
379
416
|
}
|
380
417
|
}.to_not change { MockUser.count }
|
381
418
|
|
382
|
-
expect(response.status).to eql(400)
|
419
|
+
expect(response.status ).to eql(400)
|
420
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
421
|
+
|
383
422
|
result = JSON.parse(response.body)
|
423
|
+
|
384
424
|
expect(result['scimType']).to eql('invalidValue')
|
385
425
|
expect(result['detail']).to include('is required')
|
386
426
|
end
|
@@ -393,12 +433,32 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
393
433
|
}
|
394
434
|
}.to_not change { MockUser.count }
|
395
435
|
|
396
|
-
expect(response.status).to eql(400)
|
436
|
+
expect(response.status ).to eql(400)
|
437
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
438
|
+
|
397
439
|
result = JSON.parse(response.body)
|
398
440
|
|
399
441
|
expect(result['scimType']).to eql('invalidValue')
|
400
442
|
expect(result['detail']).to include('is reserved')
|
401
443
|
end
|
444
|
+
|
445
|
+
it 'invokes a block if given one' do
|
446
|
+
mock_before = MockUser.all.to_a
|
447
|
+
attributes = { userName: '5' } # Minimum required by schema
|
448
|
+
|
449
|
+
expect_any_instance_of(CustomSaveMockUsersController).to receive(:create).once.and_call_original
|
450
|
+
expect {
|
451
|
+
post "/CustomSaveUsers", params: attributes.merge(format: :scim)
|
452
|
+
}.to change { MockUser.count }.by(1)
|
453
|
+
|
454
|
+
mock_after = MockUser.all.to_a
|
455
|
+
new_mock = (mock_after - mock_before).first
|
456
|
+
|
457
|
+
expect(response.status ).to eql(201)
|
458
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
459
|
+
|
460
|
+
expect(new_mock.username).to eql(CustomSaveMockUsersController::CUSTOM_SAVE_BLOCK_USERNAME_INDICATOR)
|
461
|
+
end
|
402
462
|
end # "context '#create' do"
|
403
463
|
|
404
464
|
# ===========================================================================
|
@@ -414,7 +474,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
414
474
|
put "/Users/#{@u2.primary_key}", params: attributes.merge(format: :scim)
|
415
475
|
}.to_not change { MockUser.count }
|
416
476
|
|
417
|
-
expect(response.status).to eql(200)
|
477
|
+
expect(response.status ).to eql(200)
|
478
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
479
|
+
|
418
480
|
result = JSON.parse(response.body)
|
419
481
|
|
420
482
|
expect(result['id']).to eql(@u2.primary_key.to_s)
|
@@ -445,8 +507,11 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
445
507
|
}
|
446
508
|
}.to_not change { MockUser.count }
|
447
509
|
|
448
|
-
expect(response.status).to eql(400)
|
510
|
+
expect(response.status ).to eql(400)
|
511
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
512
|
+
|
449
513
|
result = JSON.parse(response.body)
|
514
|
+
|
450
515
|
expect(result['scimType']).to eql('invalidValue')
|
451
516
|
expect(result['detail']).to include('is required')
|
452
517
|
|
@@ -466,7 +531,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
466
531
|
}
|
467
532
|
}.to_not change { MockUser.count }
|
468
533
|
|
469
|
-
expect(response.status).to eql(400)
|
534
|
+
expect(response.status ).to eql(400)
|
535
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
536
|
+
|
470
537
|
result = JSON.parse(response.body)
|
471
538
|
|
472
539
|
expect(result['scimType']).to eql('invalidValue')
|
@@ -488,8 +555,11 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
488
555
|
}
|
489
556
|
}.to_not change { MockUser.count }
|
490
557
|
|
491
|
-
expect(response.status).to eql(404)
|
558
|
+
expect(response.status ).to eql(404)
|
559
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
560
|
+
|
492
561
|
result = JSON.parse(response.body)
|
562
|
+
|
493
563
|
expect(result['status']).to eql('404')
|
494
564
|
end
|
495
565
|
end # "context '#replace' do"
|
@@ -521,7 +591,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
521
591
|
patch "/Users/#{@u2.primary_key}", params: payload.merge(format: :scim)
|
522
592
|
}.to_not change { MockUser.count }
|
523
593
|
|
524
|
-
expect(response.status).to eql(200)
|
594
|
+
expect(response.status ).to eql(200)
|
595
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
596
|
+
|
525
597
|
result = JSON.parse(response.body)
|
526
598
|
|
527
599
|
expect(result['id']).to eql(@u2.primary_key.to_s)
|
@@ -558,7 +630,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
558
630
|
patch "/Users/#{@u2.primary_key}", params: payload.merge(format: :scim)
|
559
631
|
}.to_not change { MockUser.count }
|
560
632
|
|
561
|
-
expect(response.status).to eql(200)
|
633
|
+
expect(response.status ).to eql(200)
|
634
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
635
|
+
|
562
636
|
result = JSON.parse(response.body)
|
563
637
|
|
564
638
|
expect(result['id']).to eql(@u2.primary_key.to_s)
|
@@ -590,7 +664,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
590
664
|
patch "/Users/#{@u2.primary_key}", params: payload.merge(format: :scim)
|
591
665
|
}.to_not change { MockUser.count }
|
592
666
|
|
593
|
-
expect(response.status).to eql(200)
|
667
|
+
expect(response.status ).to eql(200)
|
668
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
669
|
+
|
594
670
|
result = JSON.parse(response.body)
|
595
671
|
|
596
672
|
expect(result['id']).to eql(@u2.primary_key.to_s)
|
@@ -622,7 +698,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
622
698
|
patch "/Users/#{@u2.primary_key}", params: payload.merge(format: :scim)
|
623
699
|
}.to_not change { MockUser.count }
|
624
700
|
|
625
|
-
expect(response.status).to eql(200)
|
701
|
+
expect(response.status ).to eql(200)
|
702
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
703
|
+
|
626
704
|
result = JSON.parse(response.body)
|
627
705
|
|
628
706
|
expect(result['id']).to eql(@u2.primary_key.to_s)
|
@@ -661,7 +739,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
661
739
|
}
|
662
740
|
}.to_not change { MockUser.count }
|
663
741
|
|
664
|
-
expect(response.status).to eql(400)
|
742
|
+
expect(response.status ).to eql(400)
|
743
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
744
|
+
|
665
745
|
result = JSON.parse(response.body)
|
666
746
|
|
667
747
|
expect(result['scimType']).to eql('invalidValue')
|
@@ -689,8 +769,11 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
689
769
|
}
|
690
770
|
}.to_not change { MockUser.count }
|
691
771
|
|
692
|
-
expect(response.status).to eql(404)
|
772
|
+
expect(response.status ).to eql(404)
|
773
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
774
|
+
|
693
775
|
result = JSON.parse(response.body)
|
776
|
+
|
694
777
|
expect(result['status']).to eql('404')
|
695
778
|
end
|
696
779
|
|
@@ -727,7 +810,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
727
810
|
|
728
811
|
get "/Groups/#{@g1.id}", params: { format: :scim }
|
729
812
|
|
730
|
-
expect(response.status).to eql(200)
|
813
|
+
expect(response.status ).to eql(200)
|
814
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
815
|
+
|
731
816
|
result = JSON.parse(response.body)
|
732
817
|
|
733
818
|
expect(result['members']).to be_empty
|
@@ -754,7 +839,9 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
754
839
|
|
755
840
|
get "/Groups/#{@g1.id}", params: { format: :scim }
|
756
841
|
|
757
|
-
expect(response.status).to eql(200)
|
842
|
+
expect(response.status ).to eql(200)
|
843
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
844
|
+
|
758
845
|
result = JSON.parse(response.body)
|
759
846
|
|
760
847
|
expect(result['members'].map { |m| m['value'] }.sort()).to eql(expected_remaining_user_ids)
|
@@ -865,8 +952,11 @@ RSpec.describe Scimitar::ActiveRecordBackedResourcesController do
|
|
865
952
|
delete '/Users/xyz', params: { format: :scim }
|
866
953
|
}.to_not change { MockUser.count }
|
867
954
|
|
868
|
-
expect(response.status).to eql(404)
|
955
|
+
expect(response.status ).to eql(404)
|
956
|
+
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')
|
957
|
+
|
869
958
|
result = JSON.parse(response.body)
|
959
|
+
|
870
960
|
expect(result['status']).to eql('404')
|
871
961
|
end
|
872
962
|
end # "context '#destroy' do"
|
@@ -18,7 +18,7 @@ RSpec.describe Scimitar::ApplicationController do
|
|
18
18
|
parsed_body = JSON.parse(response.body)
|
19
19
|
expect(parsed_body['request']['is_scim' ]).to eql(true)
|
20
20
|
expect(parsed_body['request']['format' ]).to eql('application/scim+json')
|
21
|
-
expect(parsed_body['request']['content_type']).to eql('application/scim+json')
|
21
|
+
expect(parsed_body['request']['content_type']).to eql('application/scim+json') # Filled in by ApplicationController#require_scim
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'renders 400 if given bad JSON' do
|
@@ -26,7 +26,6 @@ RSpec.describe Scimitar::ApplicationController do
|
|
26
26
|
|
27
27
|
expect(response).to have_http_status(:bad_request)
|
28
28
|
expect(JSON.parse(response.body)['detail']).to start_with('Invalid JSON - ')
|
29
|
-
expect(JSON.parse(response.body)['detail']).to include("'not-json-12345'")
|
30
29
|
end
|
31
30
|
|
32
31
|
it 'translates Content-Type to Rails request format' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scimitar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RIPA Global
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -130,6 +130,8 @@ executables: []
|
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
|
+
- LICENSE.txt
|
134
|
+
- README.md
|
133
135
|
- Rakefile
|
134
136
|
- app/controllers/scimitar/active_record_backed_resources_controller.rb
|
135
137
|
- app/controllers/scimitar/application_controller.rb
|
@@ -196,6 +198,7 @@ files:
|
|
196
198
|
- lib/scimitar/version.rb
|
197
199
|
- spec/apps/dummy/app/controllers/custom_destroy_mock_users_controller.rb
|
198
200
|
- spec/apps/dummy/app/controllers/custom_request_verifiers_controller.rb
|
201
|
+
- spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb
|
199
202
|
- spec/apps/dummy/app/controllers/mock_groups_controller.rb
|
200
203
|
- spec/apps/dummy/app/controllers/mock_users_controller.rb
|
201
204
|
- spec/apps/dummy/app/models/mock_group.rb
|
@@ -260,13 +263,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
263
|
- !ruby/object:Gem::Version
|
261
264
|
version: '0'
|
262
265
|
requirements: []
|
263
|
-
rubygems_version: 3.4.
|
266
|
+
rubygems_version: 3.4.10
|
264
267
|
signing_key:
|
265
268
|
specification_version: 4
|
266
269
|
summary: SCIM v2 for Rails
|
267
270
|
test_files:
|
268
271
|
- spec/apps/dummy/app/controllers/custom_destroy_mock_users_controller.rb
|
269
272
|
- spec/apps/dummy/app/controllers/custom_request_verifiers_controller.rb
|
273
|
+
- spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb
|
270
274
|
- spec/apps/dummy/app/controllers/mock_groups_controller.rb
|
271
275
|
- spec/apps/dummy/app/controllers/mock_users_controller.rb
|
272
276
|
- spec/apps/dummy/app/models/mock_group.rb
|