hoodoo 1.19.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hoodoo/active/active_model/uuid_validator.rb +0 -1
  3. data/lib/hoodoo/active/active_record/dated.rb +2 -2
  4. data/lib/hoodoo/active/active_record/support.rb +2 -1
  5. data/lib/hoodoo/active/active_record/uuid.rb +2 -2
  6. data/lib/hoodoo/active/active_record/writer.rb +1 -1
  7. data/lib/hoodoo/generator.rb +52 -12
  8. data/lib/hoodoo/monkey/patch/datadog_traced_amqp.rb +11 -6
  9. data/lib/hoodoo/monkey/patch/newrelic_middleware_analytics.rb +17 -10
  10. data/lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb +71 -33
  11. data/lib/hoodoo/services/discovery/discoverers/by_drb/by_drb.rb +13 -8
  12. data/lib/hoodoo/services/middleware/exception_reporting/reporters/airbrake_reporter.rb +8 -3
  13. data/lib/hoodoo/services/middleware/interaction.rb +1 -1
  14. data/lib/hoodoo/services/middleware/middleware.rb +52 -41
  15. data/lib/hoodoo/version.rb +2 -2
  16. data/spec/active/active_record/creator_spec.rb +1 -1
  17. data/spec/active/active_record/dated_spec.rb +7 -7
  18. data/spec/active/active_record/finder_spec.rb +953 -839
  19. data/spec/active/active_record/manually_dated_spec.rb +1 -1
  20. data/spec/active/active_record/search_helper_spec.rb +1 -1
  21. data/spec/active/active_record/secure_spec.rb +2 -2
  22. data/spec/active/active_record/support_spec.rb +3 -3
  23. data/spec/monkey/patch/datadog_traced_amqp_spec.rb +10 -2
  24. data/spec/monkey/patch/newrelic_traced_amqp_spec.rb +54 -21
  25. data/spec/new_relic/agent/logger.rb +24 -0
  26. data/spec/new_relic/agent/transaction.rb +32 -0
  27. data/spec/services/discovery/discoverers/by_drb/by_drb_spec.rb +48 -2
  28. data/spec/services/middleware/exception_reporting/reporters/airbrake_reporter_spec.rb +4 -4
  29. data/spec/services/middleware/middleware_multi_local_spec.rb +41 -13
  30. data/spec/services/middleware/middleware_multi_remote_spec.rb +93 -67
  31. data/spec/services/middleware/middleware_spec.rb +80 -7
  32. data/spec/services/services/interface_spec.rb +2 -2
  33. data/spec/transient_store/transient_store/mocks/redis_spec.rb +8 -6
  34. metadata +30 -26
@@ -10,7 +10,8 @@ require 'json'
10
10
 
11
11
  # Used for X-Assume-Identity-Of testing to avoid magic value copy-and-paste.
12
12
  #
13
- VALID_ASSUMED_IDENTITY_HASH ||= { 'caller_id' => 'custom_caller_id' }
13
+ MMRS_CUSTOM_CALLER_ID = 'custom_caller_id'
14
+ MMRS_VALID_ASSUMED_IDENTITY_HASH = { 'caller_id' => MMRS_CUSTOM_CALLER_ID }
14
15
 
15
16
  # First, a test service comprised of a couple of 'echo' variants which we use
16
17
  # to make sure they're both correctly stored in the DRb registry.
@@ -49,7 +50,10 @@ class TestEchoImplementation < Hoodoo::Services::Implementation
49
50
  elsif context.request.uri_path_components[ 0 ] == 'return_invalid_data'
50
51
  context.response.body = 'Hello, world'
51
52
  elsif context.request.ident == 'return_identity' || context.request.ident == 'set_good_inter_resource_identity'
52
- context.response.body = { 'identity' => context.session.identity.to_h }
53
+ context.response.body = {
54
+ 'identity' => context.session.identity.to_h,
55
+ 'fingerprint' => context.session.caller_fingerprint
56
+ }
53
57
  else
54
58
  context.response.body = { 'show' => TestEchoImplementation.to_h( context ) }
55
59
  end
@@ -119,7 +123,8 @@ class TestEchoImplementation < Hoodoo::Services::Implementation
119
123
  'list_search_data' => context.request.list.search_data,
120
124
  'list_filter_data' => context.request.list.filter_data,
121
125
  'embeds' => context.request.embeds,
122
- 'references' => context.request.references
126
+ 'references' => context.request.references,
127
+ 'session_hash' => context.session.to_h
123
128
  }
124
129
  end
125
130
  end
@@ -218,10 +223,10 @@ class TestCallImplementation < Hoodoo::Services::Implementation
218
223
 
219
224
  if ( context.request.ident == 'set_bad_inter_resource_identity' )
220
225
  resource.assume_identity_of = {
221
- VALID_ASSUMED_IDENTITY_HASH.keys.first => Hoodoo::UUID.generate
226
+ MMRS_VALID_ASSUMED_IDENTITY_HASH.keys.first => Hoodoo::UUID.generate
222
227
  }
223
228
  elsif ( context.request.ident == 'set_good_inter_resource_identity' )
224
- resource.assume_identity_of = VALID_ASSUMED_IDENTITY_HASH
229
+ resource.assume_identity_of = MMRS_VALID_ASSUMED_IDENTITY_HASH
225
230
  end
226
231
 
227
232
  result = resource.show(
@@ -352,7 +357,7 @@ describe 'DRb start timeout' do
352
357
 
353
358
  spec_helper_http(
354
359
  port: spec_helper_start_svc_app_in_thread_for( TestEchoService ),
355
- path: '/v2/test_some_echoes'
360
+ path: '/v2/test_some_echoes' # Test 'old' route
356
361
  )
357
362
  end
358
363
  end
@@ -361,14 +366,18 @@ end
361
366
  describe Hoodoo::Services::Middleware do
362
367
 
363
368
  before :each do
364
- @test_uuid = Hoodoo::UUID.generate()
365
369
  @old_test_session = Hoodoo::Services::Middleware.test_session()
370
+
366
371
  @test_session = @old_test_session.dup
372
+ @test_session.caller_fingerprint = @caller_fingerprint = Hoodoo::UUID.generate()
373
+
367
374
  permissions = Hoodoo::Services::Permissions.new # (this is "default-else-deny")
368
375
  permissions.set_default_fallback( Hoodoo::Services::Permissions::ALLOW )
369
376
  @test_session.permissions = permissions
377
+
370
378
  @test_session.scoping = @test_session.scoping.dup
371
379
  @test_session.scoping.authorised_http_headers = [] # (no secured headers allowed to start with)
380
+
372
381
  Hoodoo::Services::Middleware.set_test_session( @test_session )
373
382
  end
374
383
 
@@ -432,7 +441,8 @@ describe Hoodoo::Services::Middleware do
432
441
  'list_search_data' => {},
433
442
  'list_filter_data' => {},
434
443
  'embeds' => [],
435
- 'references' => [ 'embed_one', 'embed_two' ]
444
+ 'references' => [ 'embed_one', 'embed_two' ],
445
+ 'session_hash' => @test_session.to_h
436
446
  }
437
447
  )
438
448
  expect( parsed[ '_dataset_size' ] ).to eq( 49 )
@@ -463,7 +473,7 @@ describe Hoodoo::Services::Middleware do
463
473
 
464
474
  response = spec_helper_http(
465
475
  port: @port,
466
- path: '/v1/test_echo_quiet'
476
+ path: '/1/TestEchoQuiet'
467
477
  )
468
478
 
469
479
  expect( response.code ).to eq( '200' )
@@ -493,7 +503,7 @@ describe Hoodoo::Services::Middleware do
493
503
 
494
504
  response = spec_helper_http(
495
505
  port: @port,
496
- path: '/v2/test_some_echoes',
506
+ path: '/v2/test_some_echoes', # Test 'old' route
497
507
  headers: { 'X-Deja-Vu' => 'yes' }
498
508
  )
499
509
 
@@ -508,7 +518,7 @@ describe Hoodoo::Services::Middleware do
508
518
 
509
519
  response = spec_helper_http(
510
520
  port: @port,
511
- path: '/v2/test_some_echoes/one/two.tar.gz?_reference=embed_one,embed_two',
521
+ path: '/2/TestEcho/one/two.tar.gz?_reference=embed_one,embed_two', # Test 'new' route
512
522
  headers: headers
513
523
  )
514
524
 
@@ -534,7 +544,8 @@ describe Hoodoo::Services::Middleware do
534
544
  'list_search_data' => {},
535
545
  'list_filter_data' => {},
536
546
  'embeds' => [],
537
- 'references' => [ 'embed_one', 'embed_two' ]
547
+ 'references' => [ 'embed_one', 'embed_two' ],
548
+ 'session_hash' => @test_session.to_h
538
549
  }
539
550
  )
540
551
  end
@@ -555,7 +566,7 @@ describe Hoodoo::Services::Middleware do
555
566
 
556
567
  response = spec_helper_http(
557
568
  port: @port,
558
- path: '/v1/test_echo_quiet/some_uuid'
569
+ path: '/1/TestEchoQuiet/some_uuid'
559
570
  )
560
571
 
561
572
  expect( response.code ).to eq( '200' )
@@ -580,7 +591,8 @@ describe Hoodoo::Services::Middleware do
580
591
  'list_search_data' => {},
581
592
  'list_filter_data' => {},
582
593
  'embeds' => [],
583
- 'references' => []
594
+ 'references' => [],
595
+ 'session_hash' => @test_session.to_h
584
596
  }
585
597
  )
586
598
  end
@@ -595,7 +607,7 @@ describe Hoodoo::Services::Middleware do
595
607
  response = spec_helper_http(
596
608
  klass: Net::HTTP::Post,
597
609
  port: @port,
598
- path: '/v2/test_some_echoes.json?_embed=embed_one,embed_two',
610
+ path: '/2/TestEcho.json?_embed=embed_one,embed_two',
599
611
  body: { 'foo' => 'bar', 'baz' => 'boo' }.to_json,
600
612
  headers: headers
601
613
  )
@@ -631,7 +643,8 @@ describe Hoodoo::Services::Middleware do
631
643
  'list_search_data' => {},
632
644
  'list_filter_data' => {},
633
645
  'embeds' => [ 'embed_one', 'embed_two' ],
634
- 'references' => []
646
+ 'references' => [],
647
+ 'session_hash' => @test_session.to_h
635
648
  }
636
649
  )
637
650
 
@@ -663,7 +676,7 @@ describe Hoodoo::Services::Middleware do
663
676
  response = spec_helper_http(
664
677
  klass: Net::HTTP::Post,
665
678
  port: @port,
666
- path: '/v2/test_some_echoes.json',
679
+ path: '/2/TestEcho.json',
667
680
  body: { 'foo' => 'bar', 'baz' => 'boo' }.to_json,
668
681
  headers: { 'X-Resource-UUID' => Hoodoo::UUID.generate() }
669
682
  )
@@ -682,7 +695,7 @@ describe Hoodoo::Services::Middleware do
682
695
  response = spec_helper_http(
683
696
  klass: Net::HTTP::Post,
684
697
  port: @port,
685
- path: '/v2/test_some_echoes',
698
+ path: '/2/TestEcho',
686
699
  body: { 'foo' => 'bar' }.to_json,
687
700
  headers: { 'X-Deja-Vu' => 'yes' }
688
701
  )
@@ -698,7 +711,7 @@ describe Hoodoo::Services::Middleware do
698
711
  response = spec_helper_http(
699
712
  klass: Net::HTTP::Post,
700
713
  port: @port,
701
- path: '/v2/test_some_echoes',
714
+ path: '/2/TestEcho',
702
715
  body: { 'foo' => 'bar', 'additional_error' => 'generic.invalid_decimal' }.to_json,
703
716
  headers: { 'X-Deja-Vu' => 'yes' }
704
717
  )
@@ -722,7 +735,7 @@ describe Hoodoo::Services::Middleware do
722
735
  response = spec_helper_http(
723
736
  klass: Net::HTTP::Patch,
724
737
  port: @port,
725
- path: '/v2/test_some_echoes/a/b.json?_embed=embed_one',
738
+ path: '/2/TestEcho/a/b.json?_embed=embed_one',
726
739
  body: { 'foo' => 'boo', 'baz' => 'bar' }.to_json,
727
740
  headers: headers
728
741
  )
@@ -749,7 +762,8 @@ describe Hoodoo::Services::Middleware do
749
762
  'list_search_data' => {},
750
763
  'list_filter_data' => {},
751
764
  'embeds' => [ 'embed_one' ],
752
- 'references' => []
765
+ 'references' => [],
766
+ 'session_hash' => @test_session.to_h
753
767
  }
754
768
  )
755
769
  end
@@ -774,7 +788,7 @@ describe Hoodoo::Services::Middleware do
774
788
  response = spec_helper_http(
775
789
  klass: Net::HTTP::Delete,
776
790
  port: @port,
777
- path: '/v2/test_some_echoes/aa/bb.xml.gz?_embed=embed_two',
791
+ path: '/2/TestEcho/aa/bb.xml.gz?_embed=embed_two',
778
792
  headers: headers
779
793
  )
780
794
 
@@ -800,7 +814,8 @@ describe Hoodoo::Services::Middleware do
800
814
  'list_search_data' => {},
801
815
  'list_filter_data' => {},
802
816
  'embeds' => [ 'embed_two' ],
803
- 'references' => []
817
+ 'references' => [],
818
+ 'session_hash' => @test_session.to_h
804
819
  }
805
820
  )
806
821
  end
@@ -821,7 +836,7 @@ describe Hoodoo::Services::Middleware do
821
836
  response = spec_helper_http(
822
837
  klass: Net::HTTP::Delete,
823
838
  port: @port,
824
- path: '/v2/test_some_echoes/simulate_404' )
839
+ path: '/2/TestEcho/simulate_404' )
825
840
 
826
841
  expect( response.code ).to eq( '404' )
827
842
  expect_response_headers_on( response )
@@ -835,7 +850,7 @@ describe Hoodoo::Services::Middleware do
835
850
  response = spec_helper_http(
836
851
  klass: Net::HTTP::Delete,
837
852
  port: @port,
838
- path: '/v2/test_some_echoes/simulate_404',
853
+ path: '/2/TestEcho/simulate_404',
839
854
  headers: { 'X-Deja-Vu' => 'yes' }
840
855
  )
841
856
 
@@ -853,7 +868,7 @@ describe Hoodoo::Services::Middleware do
853
868
  response = spec_helper_http(
854
869
  klass: Net::HTTP::Post,
855
870
  port: @port,
856
- path: '/v1/test_echo_quiet',
871
+ path: '/1/TestEchoQuiet',
857
872
  body: { 'foo' => 'bar', 'baz' => 'boo' }.to_json
858
873
  )
859
874
 
@@ -864,7 +879,7 @@ describe Hoodoo::Services::Middleware do
864
879
  it 'should be detect 404 OK' do
865
880
  response = spec_helper_http(
866
881
  port: @port,
867
- path: '/v1/not_present'
882
+ path: '/1/NotPresent'
868
883
  )
869
884
 
870
885
  expect( response.code ).to eq( '404' )
@@ -921,7 +936,7 @@ describe Hoodoo::Services::Middleware do
921
936
 
922
937
  def list_things( locale: nil, dated_at: nil )
923
938
  get(
924
- '/v1/test_call.tar.gz?limit=25&offset=75',
939
+ '/1/TestCall.tar.gz?limit=25&offset=75',
925
940
  nil,
926
941
  headers_for( locale: locale, dated_at: dated_at )
927
942
  )
@@ -955,7 +970,8 @@ describe Hoodoo::Services::Middleware do
955
970
  'list_search_data' => {},
956
971
  'list_filter_data' => {},
957
972
  'embeds' => [],
958
- 'references' => []
973
+ 'references' => [],
974
+ 'session_hash' => @test_session.to_h
959
975
  }
960
976
  )
961
977
 
@@ -991,7 +1007,7 @@ describe Hoodoo::Services::Middleware do
991
1007
  end
992
1008
 
993
1009
  get(
994
- '/v1/test_call.tar.gz?limit=25&offset=75',
1010
+ '/1/TestCall.tar.gz?limit=25&offset=75',
995
1011
  nil,
996
1012
  headers_for( locale: 'de' )
997
1013
  )
@@ -1017,7 +1033,7 @@ describe Hoodoo::Services::Middleware do
1017
1033
  end
1018
1034
 
1019
1035
  get(
1020
- '/v1/test_call.tar.gz?offset=42', # 42 -> magic -> inner service adds error
1036
+ '/1/TestCall.tar.gz?offset=42', # 42 -> magic -> inner service adds error
1021
1037
  nil,
1022
1038
  headers_for( locale: 'de' )
1023
1039
  )
@@ -1028,7 +1044,7 @@ describe Hoodoo::Services::Middleware do
1028
1044
 
1029
1045
  def show_things( locale: nil, dated_at: nil )
1030
1046
  get(
1031
- '/v1/test_call/one/two.tar.gz',
1047
+ '/1/TestCall/one/two.tar.gz',
1032
1048
  nil,
1033
1049
  headers_for( locale: locale, dated_at: dated_at )
1034
1050
  )
@@ -1053,7 +1069,8 @@ describe Hoodoo::Services::Middleware do
1053
1069
  'list_search_data' => {},
1054
1070
  'list_filter_data' => {},
1055
1071
  'embeds' => [],
1056
- 'references' => []
1072
+ 'references' => [],
1073
+ 'session_hash' => @test_session.to_h
1057
1074
  }
1058
1075
  )
1059
1076
 
@@ -1079,7 +1096,7 @@ describe Hoodoo::Services::Middleware do
1079
1096
  expect( result.platform_errors.has_errors? ).to eq( true )
1080
1097
  end
1081
1098
 
1082
- get( '/v1/test_call/return_error', nil, headers_for() )
1099
+ get( '/1/TestCall/return_error', nil, headers_for() )
1083
1100
 
1084
1101
  result = JSON.parse(last_response.body)
1085
1102
  expect(result['errors'][0]['code']).to eq('generic.invalid_string')
@@ -1091,7 +1108,7 @@ describe Hoodoo::Services::Middleware do
1091
1108
  expect( result.platform_errors.has_errors? ).to eq( true )
1092
1109
  end
1093
1110
 
1094
- get( '/v1/test_call/return_invalid_data', nil, headers_for() )
1111
+ get( '/1/TestCall/return_invalid_data', nil, headers_for() )
1095
1112
 
1096
1113
  result = JSON.parse(last_response.body)
1097
1114
  expect(result['errors'][0]['code']).to eq('platform.fault')
@@ -1109,8 +1126,8 @@ describe Hoodoo::Services::Middleware do
1109
1126
 
1110
1127
  test_session.scoping.authorised_http_headers = [ 'X-Assume-Identity-Of' ]
1111
1128
  test_session.scoping.authorised_identities = {
1112
- VALID_ASSUMED_IDENTITY_HASH.keys.first =>
1113
- [ VALID_ASSUMED_IDENTITY_HASH.values.first ]
1129
+ MMRS_VALID_ASSUMED_IDENTITY_HASH.keys.first =>
1130
+ [ MMRS_VALID_ASSUMED_IDENTITY_HASH.values.first ]
1114
1131
  }
1115
1132
 
1116
1133
  Hoodoo::Services::Middleware.set_test_session( test_session )
@@ -1123,25 +1140,29 @@ describe Hoodoo::Services::Middleware do
1123
1140
  context 'when in use at top level' do
1124
1141
  it 'sees correct identity in the downstream resource' do
1125
1142
  get(
1126
- '/v1/test_call/return_identity',
1143
+ '/1/TestCall/return_identity',
1127
1144
  nil,
1128
1145
  {
1129
1146
  'CONTENT_TYPE' => 'application/json; charset=utf-8',
1130
- 'HTTP_X_ASSUME_IDENTITY_OF' => URI.encode_www_form( VALID_ASSUMED_IDENTITY_HASH )
1147
+ 'HTTP_X_ASSUME_IDENTITY_OF' => URI.encode_www_form( MMRS_VALID_ASSUMED_IDENTITY_HASH )
1131
1148
  }
1132
1149
  )
1133
1150
 
1134
1151
  result = JSON.parse( last_response.body )
1135
- expect( result[ 'show' ][ 'identity' ] ).to eq( VALID_ASSUMED_IDENTITY_HASH )
1152
+
1153
+ expect( result[ 'show' ] ).to eq( {
1154
+ 'identity' => MMRS_VALID_ASSUMED_IDENTITY_HASH,
1155
+ 'fingerprint' => @caller_fingerprint
1156
+ } )
1136
1157
  end
1137
1158
 
1138
1159
  it 'cannot set an illegal identity in the inter-resource call' do
1139
1160
  get(
1140
- '/v1/test_call/set_bad_inter_resource_identity',
1161
+ '/1/TestCall/set_bad_inter_resource_identity',
1141
1162
  nil,
1142
1163
  {
1143
1164
  'CONTENT_TYPE' => 'application/json; charset=utf-8',
1144
- 'HTTP_X_ASSUME_IDENTITY_OF' => URI.encode_www_form( VALID_ASSUMED_IDENTITY_HASH )
1165
+ 'HTTP_X_ASSUME_IDENTITY_OF' => URI.encode_www_form( MMRS_VALID_ASSUMED_IDENTITY_HASH )
1145
1166
  }
1146
1167
  )
1147
1168
 
@@ -1152,22 +1173,24 @@ describe Hoodoo::Services::Middleware do
1152
1173
  end
1153
1174
 
1154
1175
  context 'in inter-resource call only' do
1155
- identity_hash = { 'caller_id' => 'custom_caller_id' }
1156
-
1157
1176
  it 'can still set identity for the downstream resource' do
1158
1177
  get(
1159
- '/v1/test_call/set_good_inter_resource_identity',
1178
+ '/1/TestCall/set_good_inter_resource_identity',
1160
1179
  nil,
1161
1180
  { 'CONTENT_TYPE' => 'application/json; charset=utf-8' }
1162
1181
  )
1163
1182
 
1164
1183
  result = JSON.parse( last_response.body )
1165
- expect( result[ 'show' ][ 'identity' ] ).to eq( VALID_ASSUMED_IDENTITY_HASH )
1184
+
1185
+ expect( result[ 'show' ] ).to eq( {
1186
+ 'identity' => MMRS_VALID_ASSUMED_IDENTITY_HASH,
1187
+ 'fingerprint' => @caller_fingerprint
1188
+ } )
1166
1189
  end
1167
1190
 
1168
1191
  it 'cannot set an illegal identity for the downstream resource' do
1169
1192
  get(
1170
- '/v1/test_call/set_bad_inter_resource_identity',
1193
+ '/1/TestCall/set_bad_inter_resource_identity',
1171
1194
  nil,
1172
1195
  { 'CONTENT_TYPE' => 'application/json; charset=utf-8' }
1173
1196
  )
@@ -1188,7 +1211,7 @@ describe Hoodoo::Services::Middleware do
1188
1211
  test_session.scoping = test_session.scoping.dup
1189
1212
 
1190
1213
  test_session.scoping.authorised_http_headers = [] # NO ALLOWED HEADERS
1191
- test_session.scoping.authorised_identities = { 'caller_id' => [ 'custom_caller_id' ] }
1214
+ test_session.scoping.authorised_identities = { 'caller_id' => [ MMRS_CUSTOM_CALLER_ID ] }
1192
1215
 
1193
1216
  Hoodoo::Services::Middleware.set_test_session( test_session )
1194
1217
  end
@@ -1202,7 +1225,7 @@ describe Hoodoo::Services::Middleware do
1202
1225
  #
1203
1226
  it 'cannot override a valid identity in inter-resource calls' do
1204
1227
  get(
1205
- '/v1/test_call/set_good_inter_resource_identity',
1228
+ '/1/TestCall/set_good_inter_resource_identity',
1206
1229
  nil,
1207
1230
  { 'CONTENT_TYPE' => 'application/json; charset=utf-8' }
1208
1231
  )
@@ -1216,7 +1239,7 @@ describe Hoodoo::Services::Middleware do
1216
1239
 
1217
1240
  def create_things( locale: nil, dated_from: nil, deja_vu: nil, resource_uuid: nil )
1218
1241
  post(
1219
- '/v1/test_call.tar.gz',
1242
+ '/1/TestCall.tar.gz',
1220
1243
  { 'foo' => 'bar', 'baz' => 'boo' }.to_json,
1221
1244
  headers_for( locale: locale, dated_from: dated_from, deja_vu: deja_vu, resource_uuid: resource_uuid )
1222
1245
  )
@@ -1241,7 +1264,8 @@ describe Hoodoo::Services::Middleware do
1241
1264
  'list_search_data' => {},
1242
1265
  'list_filter_data' => {},
1243
1266
  'embeds' => [],
1244
- 'references' => []
1267
+ 'references' => [],
1268
+ 'session_hash' => @test_session.to_h
1245
1269
  }
1246
1270
  )
1247
1271
 
@@ -1265,7 +1289,7 @@ describe Hoodoo::Services::Middleware do
1265
1289
  @test_session.scoping.authorised_http_headers = [ 'HTTP_X_RESOURCE_UUID' ]
1266
1290
 
1267
1291
  post(
1268
- '/v1/test_call.tar.gz',
1292
+ '/1/TestCall.tar.gz',
1269
1293
  { :foo => 'specify_uuid' }.to_json,
1270
1294
  headers_for()
1271
1295
  )
@@ -1280,7 +1304,7 @@ describe Hoodoo::Services::Middleware do
1280
1304
 
1281
1305
  it 'cannot specify a UUID via an inter-resource call if it does not have top-level permission' do
1282
1306
  post(
1283
- '/v1/test_call.tar.gz',
1307
+ '/1/TestCall.tar.gz',
1284
1308
  { :foo => 'specify_uuid' }.to_json,
1285
1309
  headers_for()
1286
1310
  )
@@ -1302,7 +1326,7 @@ describe Hoodoo::Services::Middleware do
1302
1326
  #
1303
1327
  it 'gets a 204 with deja-vu and duplication' do
1304
1328
  post(
1305
- '/v1/test_call.tar.gz',
1329
+ '/1/TestCall.tar.gz',
1306
1330
  { 'foo' => 'bar', 'deja_vu_in_other_resource' => 'yes' }.to_json,
1307
1331
  headers_for() # *not* requesting Deja-Vu at the top level
1308
1332
  )
@@ -1322,7 +1346,7 @@ describe Hoodoo::Services::Middleware do
1322
1346
 
1323
1347
  it 'gets non-204 with deja-vu and duplication plus other errors' do
1324
1348
  post(
1325
- '/v1/test_call.tar.gz',
1349
+ '/1/TestCall.tar.gz',
1326
1350
  {
1327
1351
  'foo' => 'bar',
1328
1352
  'deja_vu_in_other_resource' => 'yes',
@@ -1353,7 +1377,7 @@ describe Hoodoo::Services::Middleware do
1353
1377
  expect_any_instance_of( Hoodoo::Client::Endpoint::HTTPBased::DescriptionOfResponse ).to receive( :raw_body_data ).and_return( 'not JSON' )
1354
1378
 
1355
1379
  post(
1356
- '/v1/test_call.tar.gz',
1380
+ '/1/TestCall.tar.gz',
1357
1381
  { 'foo' => 'bar' }.to_json,
1358
1382
  headers_for()
1359
1383
  )
@@ -1376,7 +1400,7 @@ describe Hoodoo::Services::Middleware do
1376
1400
  end
1377
1401
 
1378
1402
  post(
1379
- '/v1/test_call.tar.gz',
1403
+ '/1/TestCall.tar.gz',
1380
1404
  { :foo => 'bar', :return_error => 'yes' }.to_json,
1381
1405
  headers_for()
1382
1406
  )
@@ -1387,7 +1411,7 @@ describe Hoodoo::Services::Middleware do
1387
1411
 
1388
1412
  def update_things( locale: nil )
1389
1413
  patch(
1390
- '/v1/test_call/aa/bb.tar.gz',
1414
+ '/1/TestCall/aa/bb.tar.gz',
1391
1415
  { 'foo' => 'boo', 'baz' => 'bar' }.to_json,
1392
1416
  headers_for( locale: locale )
1393
1417
  )
@@ -1412,7 +1436,8 @@ describe Hoodoo::Services::Middleware do
1412
1436
  'list_search_data' => {},
1413
1437
  'list_filter_data' => {},
1414
1438
  'embeds' => [],
1415
- 'references' => []
1439
+ 'references' => [],
1440
+ 'session_hash' => @test_session.to_h
1416
1441
  }
1417
1442
  )
1418
1443
 
@@ -1439,7 +1464,7 @@ describe Hoodoo::Services::Middleware do
1439
1464
  expect( result.platform_errors.has_errors? ).to eq( true )
1440
1465
  end
1441
1466
 
1442
- patch( '/v1/test_call/return_error', '{}', headers_for() )
1467
+ patch( '/1/TestCall/return_error', '{}', headers_for() )
1443
1468
 
1444
1469
  result = JSON.parse(last_response.body)
1445
1470
  expect(result['errors'][0]['code']).to eq('platform.malformed')
@@ -1447,7 +1472,7 @@ describe Hoodoo::Services::Middleware do
1447
1472
 
1448
1473
  def delete_things( locale: nil, deja_vu: nil )
1449
1474
  delete(
1450
- '/v1/test_call/aone/btwo.tar.gz',
1475
+ '/1/TestCall/aone/btwo.tar.gz',
1451
1476
  nil,
1452
1477
  headers_for( locale:locale, deja_vu: deja_vu )
1453
1478
  )
@@ -1472,7 +1497,8 @@ describe Hoodoo::Services::Middleware do
1472
1497
  'list_search_data' => {},
1473
1498
  'list_filter_data' => {},
1474
1499
  'embeds' => [],
1475
- 'references' => []
1500
+ 'references' => [],
1501
+ 'session_hash' => @test_session.to_h
1476
1502
  }
1477
1503
  )
1478
1504
 
@@ -1494,7 +1520,7 @@ describe Hoodoo::Services::Middleware do
1494
1520
 
1495
1521
  it 'should receive errors from remote service as if from the local call' do
1496
1522
  get(
1497
- '/v1/test_call/return_error',
1523
+ '/1/TestCall/return_error',
1498
1524
  nil,
1499
1525
  { 'CONTENT_TYPE' => 'application/json; charset=utf-8' }
1500
1526
  )
@@ -1520,7 +1546,7 @@ describe Hoodoo::Services::Middleware do
1520
1546
  end
1521
1547
 
1522
1548
  get(
1523
- '/v1/test_call/generate_404',
1549
+ '/1/TestCall/generate_404',
1524
1550
  nil,
1525
1551
  { 'CONTENT_TYPE' => 'application/json; charset=utf-8' }
1526
1552
  )
@@ -1531,7 +1557,7 @@ describe Hoodoo::Services::Middleware do
1531
1557
 
1532
1558
  it 'can reuse an endpoint' do
1533
1559
  get(
1534
- '/v1/test_call/ensure_repeated_use_works',
1560
+ '/1/TestCall/ensure_repeated_use_works',
1535
1561
  nil,
1536
1562
  { 'CONTENT_TYPE' => 'application/json; charset=utf-8' }
1537
1563
  )
@@ -1559,7 +1585,7 @@ describe Hoodoo::Services::Middleware do
1559
1585
  expect_any_instance_of( Net::HTTP ).to receive( :request ).once.and_raise( Errno::ECONNREFUSED )
1560
1586
 
1561
1587
  get(
1562
- '/v1/test_call/show_something',
1588
+ '/1/TestCall/show_something',
1563
1589
  nil,
1564
1590
  { 'CONTENT_TYPE' => 'application/json; charset=utf-8' }
1565
1591
  )
@@ -1574,7 +1600,7 @@ describe Hoodoo::Services::Middleware do
1574
1600
  expect_any_instance_of( Net::HTTP ).to receive( :request ).once.and_raise( 'some connection error' )
1575
1601
 
1576
1602
  get(
1577
- '/v1/test_call/show_something',
1603
+ '/1/TestCall/show_something',
1578
1604
  nil,
1579
1605
  { 'CONTENT_TYPE' => 'application/json; charset=utf-8' }
1580
1606
  )