maestrano-connector-rails 1.3.5 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/release_notes.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 1.3.5
2
+
3
+ ## Features
4
+ * Improve generated files
5
+ * Adds a built-in way to handle error when updating a deleted record
6
+
7
+ ## Fixes
8
+ * Adds safety against potential infinite loop
9
+
1
10
  ## 1.3.4
2
11
  `maestrano.rb` file should be updated with new synchronization paths.
3
12
 
@@ -71,7 +71,7 @@ describe 'complex entities workflow' do
71
71
  def self.references
72
72
  {'CompOrganization' => ['ref_id']}
73
73
  end
74
- def map_to(name, entity)
74
+ def map_to(name, entity, first_time_mapped = nil)
75
75
  super.merge(is_supplier: false)
76
76
  end
77
77
  end
@@ -94,7 +94,7 @@ describe 'complex entities workflow' do
94
94
  def self.references
95
95
  {'CompOrganization' => ['ref_id']}
96
96
  end
97
- def map_to(name, entity)
97
+ def map_to(name, entity, first_time_mapped = nil)
98
98
  super.merge(is_supplier: true)
99
99
  end
100
100
  end
@@ -213,11 +213,11 @@ describe 'complex entities workflow' do
213
213
  }
214
214
  let!(:supplier_idmap) { Entities::SubEntities::CompSupplier.create_idmap(organization_id: organization.id, external_id: ext_supplier_id, connec_entity: 'comporganization') }
215
215
 
216
- before {
216
+ before do
217
217
  allow(connec_client).to receive(:get).and_return(ActionDispatch::Response.new(200, {}, {comporganizations: connec_orgs}.to_json, {}))
218
218
  allow_any_instance_of(Entities::SubEntities::CompCustomer).to receive(:get_external_entities).and_return([ext_customer])
219
219
  allow_any_instance_of(Entities::SubEntities::CompSupplier).to receive(:get_external_entities).and_return([ext_supplier])
220
- }
220
+ end
221
221
 
222
222
  subject { Maestrano::Connector::Rails::SynchronizationJob.new.sync_entity('customer_and_supplier', organization, connec_client, external_client, nil, {}) }
223
223
 
@@ -278,4 +278,298 @@ describe 'complex entities workflow' do
278
278
  expect(connec_client).to receive(:batch).exactly(3).times.and_return(ActionDispatch::Response.new(201, {}, {results: []}.to_json, {}), ActionDispatch::Response.new(200, {}, {results: []}.to_json, {}))
279
279
  subject
280
280
  end
281
+
282
+ describe "when using creation_mapper_classes" do
283
+
284
+ before do
285
+ allow(connec_client).to receive(:get).and_return(ActionDispatch::Response.new(200, {}, {comporganizationmissingfields: connec_orgs}.to_json, {}))
286
+ allow_any_instance_of(Entities::SubEntities::CompCustomerMissingField).to receive(:get_external_entities).and_return([ext_customer])
287
+ allow_any_instance_of(Entities::SubEntities::CompSupplierMissingField).to receive(:get_external_entities).and_return([ext_supplier])
288
+ end
289
+
290
+ let(:subject_missing_field) { Maestrano::Connector::Rails::SynchronizationJob.new.sync_entity('customer_and_supplier_missing_field', organization, connec_client, external_client, nil, {}) }
291
+
292
+ class Entities::CustomerAndSupplierMissingField < Maestrano::Connector::Rails::ComplexEntity
293
+ def self.connec_entities_names
294
+ %w(CompOrganizationMissingField)
295
+ end
296
+ def self.external_entities_names
297
+ %w(CompCustomerMissingField CompSupplierMissingField)
298
+ end
299
+ def connec_model_to_external_model(connec_hash_of_entities)
300
+ organizations_missing_field = connec_hash_of_entities['CompOrganizationMissingField']
301
+ modelled_connec_entities = { 'CompOrganizationMissingField' => { 'CompSupplierMissingField' => [], 'CompCustomerMissingField' => [] } }
302
+
303
+ organizations_missing_field.each do |organization|
304
+ if organization['is_supplier']
305
+ modelled_connec_entities['CompOrganizationMissingField']['CompSupplierMissingField'] << organization
306
+ else
307
+ modelled_connec_entities['CompOrganizationMissingField']['CompCustomerMissingField'] << organization
308
+ end
309
+ end
310
+
311
+ return modelled_connec_entities
312
+ end
313
+
314
+ def external_model_to_connec_model(external_hash_of_entities)
315
+ return {'CompCustomerMissingField' => {'CompOrganizationMissingField' => external_hash_of_entities['CompCustomerMissingField']}, 'CompSupplierMissingField' => {'CompOrganizationMissingField' => external_hash_of_entities['CompSupplierMissingField']}}
316
+ end
317
+ end
318
+
319
+ class Entities::SubEntities::CompOrganizationMissingField < Entities::SubEntities::CompOrganization
320
+
321
+ def self.entity_name
322
+ 'CompOrganizationMissingField'
323
+ end
324
+
325
+ def self.mapper_classes
326
+ {
327
+ 'CompCustomerMissingField' => ::CompMapper,
328
+ 'CompSupplierMissingField' => ::CompMapper
329
+ }
330
+ end
331
+
332
+ def self.creation_mapper_classes
333
+ {
334
+ 'CompCustomerMissingField' => ::CreationCompMapper,
335
+ 'CompSupplierMissingField' => ::CreationCompMapper
336
+ }
337
+ end
338
+
339
+ def self.references
340
+ {'CompCustomerMissingField' => ['ref_id'], 'CompSupplierMissingField' => ['ref_id']}
341
+ end
342
+ end
343
+
344
+ class Entities::SubEntities::CompCustomerMissingField < Maestrano::Connector::Rails::SubEntityBase
345
+ def self.external?
346
+ true
347
+ end
348
+
349
+ def self.entity_name
350
+ 'CompCustomerMissingField'
351
+ end
352
+
353
+ def self.creation_mapper_classes
354
+ {'CompOrganizationMissingField' => ::CreationCompMapper}
355
+ end
356
+
357
+ def self.id_from_external_entity_hash(entity)
358
+ entity['id']
359
+ end
360
+
361
+ def self.object_name_from_external_entity_hash(entity)
362
+ entity['name']
363
+ end
364
+
365
+ def self.references
366
+ {'CompOrganizationMissingField' => ['ref_id']}
367
+ end
368
+
369
+ def map_to(name, entity, first_time_mapped = nil)
370
+ super.merge(is_supplier: false)
371
+ end
372
+ end
373
+
374
+ class Entities::SubEntities::CompSupplierMissingField < Maestrano::Connector::Rails::SubEntityBase
375
+ def self.external?
376
+ true
377
+ end
378
+
379
+ def self.entity_name
380
+ 'CompSupplierMissingField'
381
+ end
382
+
383
+ def self.mapper_classes
384
+ {'CompOrganizationMissingField' => ::CompMapper}
385
+ end
386
+
387
+ def self.id_from_external_entity_hash(entity)
388
+ entity['id']
389
+ end
390
+
391
+ def self.object_name_from_external_entity_hash(entity)
392
+ entity['name']
393
+ end
394
+
395
+ def self.references
396
+ {'CompOrganizationMissingField' => ['ref_id']}
397
+ end
398
+
399
+ def map_to(name, entity, first_time_mapped = nil)
400
+ super.merge(is_supplier: true)
401
+ end
402
+ end
403
+
404
+ class CreationCompMapper < CompMapper
405
+ after_normalize do |input, output|
406
+ output[:missing_field] = "Default"
407
+ output
408
+ end
409
+
410
+ after_denormalize do |input, output|
411
+ output[:missing_field] = "Default"
412
+ output
413
+ end
414
+ end
415
+
416
+ let(:mapped_connec_org1) {
417
+ {
418
+ ref_id: connec_org1_ext_ref_id,
419
+ name: connec_org1_name,
420
+ missing_field: "Default"
421
+ }
422
+ }
423
+
424
+ let(:mapped_connec_org2) {
425
+ {
426
+ ref_id: connec_org2_ext_ref_id,
427
+ name: connec_org2_name,
428
+ id: connec_org2_ext_id,
429
+ missing_field: "Default"
430
+ }
431
+ }
432
+
433
+ let(:mapped_ext_customer) {
434
+ {
435
+ :id => [
436
+ {
437
+ :id => ext_customer_id,
438
+ :provider => provider,
439
+ :realm => oauth_uid
440
+ }
441
+ ],
442
+ :ref_id => [
443
+ {
444
+ :id => ext_ref_id,
445
+ :provider => provider,
446
+ :realm => oauth_uid
447
+ }
448
+ ],
449
+ :name => ext_customer_name,
450
+ :is_supplier => false,
451
+ :missing_field => "Default"
452
+ }
453
+ }
454
+
455
+ let(:mapped_ext_supplier) {
456
+ {
457
+ :id => [
458
+ {
459
+ :id => ext_supplier_id,
460
+ :provider => provider,
461
+ :realm => oauth_uid
462
+ }
463
+ ],
464
+ :ref_id => [
465
+ {
466
+ :id => ext_ref_id,
467
+ :provider => provider,
468
+ :realm => oauth_uid
469
+ }
470
+ ],
471
+ :name => ext_supplier_name,
472
+ :is_supplier => true
473
+ }
474
+ }
475
+
476
+ let!(:supplier_missing_field_idmap) { Entities::SubEntities::CompSupplierMissingField.create_idmap(organization_id: organization.id, external_id: ext_supplier_id, connec_entity: 'comporganizationmissingfield') }
477
+
478
+ it 'handles the mapping correctly' do
479
+ cust_idmap = Entities::SubEntities::CompCustomerMissingField.create_idmap(organization_id: organization.id, external_id: ext_customer_id, connec_entity: 'comporganizationmissingfield')
480
+ org1_idmap = Entities::SubEntities::CompOrganizationMissingField.create_idmap(organization_id: organization.id, external_id: connec_org1_ext_id, external_entity: 'compsuppliermissingfield')
481
+ org2_idmap = Entities::SubEntities::CompOrganizationMissingField.create_idmap(organization_id: organization.id, external_id: connec_org2_ext_id, external_entity: 'compcustomermissingfield')
482
+ allow(Maestrano::Connector::Rails::IdMap).to receive(:create).and_return(org1_idmap, org2_idmap, cust_idmap)
483
+ expect_any_instance_of(Entities::CustomerAndSupplierMissingField).to receive(:push_entities_to_external).with({'CompOrganizationMissingField' => {'CompSupplierMissingField' => [{entity: mapped_connec_org1.with_indifferent_access, idmap: org1_idmap, id_refs_only_connec_entity: {}}], 'CompCustomerMissingField' => [{entity: mapped_connec_org2.with_indifferent_access, idmap: org2_idmap, id_refs_only_connec_entity: {}}]}})
484
+ expect_any_instance_of(Entities::CustomerAndSupplierMissingField).to receive(:push_entities_to_connec).with({'CompCustomerMissingField' => {'CompOrganizationMissingField' => [{entity: mapped_ext_customer.with_indifferent_access, idmap: cust_idmap}]}, 'CompSupplierMissingField' => {'CompOrganizationMissingField' => [{entity: mapped_ext_supplier.with_indifferent_access, idmap: supplier_missing_field_idmap}]}})
485
+ subject_missing_field
486
+ end
487
+
488
+ context "with idmap and last_push_to_external field present it does not overwrite the missing field" do
489
+
490
+ let(:subject_already_pushed_entities) { Maestrano::Connector::Rails::SynchronizationJob.new.sync_entity('customer_and_supplier_missing_field', organization, connec_client, external_client, nil, {}) }
491
+
492
+ before do
493
+ allow(connec_client).to receive(:get).and_return(ActionDispatch::Response.new(200, {}, {comporganizationmissingfields: connec_orgs_already_pushed}.to_json, {}))
494
+ allow_any_instance_of(Entities::SubEntities::CompCustomerMissingField).to receive(:get_external_entities).and_return([ext_customer])
495
+ allow_any_instance_of(Entities::SubEntities::CompSupplierMissingField).to receive(:get_external_entities).and_return([ext_supplier])
496
+ end
497
+
498
+ let(:connec_org1_already_pushed) { connec_org1.merge!(updated_at: "2015-08-10T14:42:38Z", 'id' => connec_org1['id'].push({'provider' => provider, 'id' => connec_org1_ext_id, 'realm' => oauth_uid})) }
499
+ let(:connec_org2_already_pushed) { connec_org2.merge!(updated_at: "2015-08-10T14:42:38Z", 'id' => connec_org2['id'].push({'provider' => provider, 'id' => connec_org2_ext_id, 'realm' => oauth_uid})) }
500
+
501
+ let(:connec_orgs_already_pushed) { [connec_org1_already_pushed, connec_org2_already_pushed] }
502
+
503
+ let(:mapped_connec_org1) {
504
+ {
505
+ id: connec_org1_ext_id,
506
+ ref_id: connec_org1_ext_ref_id,
507
+ name: connec_org1_name
508
+ }
509
+ }
510
+
511
+ let(:mapped_connec_org2) {
512
+ {
513
+ id: connec_org2_ext_id,
514
+ ref_id: connec_org2_ext_ref_id,
515
+ name: connec_org2_name
516
+
517
+ }
518
+ }
519
+
520
+ let(:mapped_ext_customer) {
521
+ {
522
+ :id => [
523
+ {
524
+ :id => ext_customer_id,
525
+ :provider => provider,
526
+ :realm => oauth_uid
527
+ }
528
+ ],
529
+ :ref_id => [
530
+ {
531
+ :id => ext_ref_id,
532
+ :provider => provider,
533
+ :realm => oauth_uid
534
+ }
535
+ ],
536
+ :name => ext_customer_name,
537
+ :is_supplier => false,
538
+ :missing_field => "Default"
539
+ }
540
+ }
541
+
542
+ let(:mapped_ext_supplier) {
543
+ {
544
+ :id => [
545
+ {
546
+ :id => ext_supplier_id,
547
+ :provider => provider,
548
+ :realm => oauth_uid
549
+ }
550
+ ],
551
+ :ref_id => [
552
+ {
553
+ :id => ext_ref_id,
554
+ :provider => provider,
555
+ :realm => oauth_uid
556
+ }
557
+ ],
558
+ :name => ext_supplier_name,
559
+ :is_supplier => true
560
+ }
561
+ }
562
+
563
+ let!(:supplier_missing_field_idmap) { Entities::SubEntities::CompSupplierMissingField.create_idmap(organization_id: organization.id, external_id: ext_supplier_id, connec_entity: 'comporganizationmissingfield', last_push_to_external: "2014-08-10T14:42:38Z") }
564
+ let!(:customer_missing_field_idmap) { Entities::SubEntities::CompCustomerMissingField.create_idmap(organization_id: organization.id, external_id: ext_customer_id, connec_entity: 'comporganizationmissingfield', last_push_to_external: "2014-08-10T14:42:38Z") }
565
+ let!(:org1_missing_field_idmap) { Entities::SubEntities::CompOrganizationMissingField.create_idmap(organization_id: organization.id, external_id: connec_org1_ext_id, external_entity: 'compsuppliermissingfield', connec_id: connec_org1_id, name: connec_org1_name, last_push_to_external: "2014-08-10T14:42:38Z") }
566
+ let!(:org2_missing_field_idmap) { Entities::SubEntities::CompOrganizationMissingField.create_idmap(organization_id: organization.id, external_id: connec_org2_ext_id, external_entity: 'compcustomermissingfield', connec_id: connec_org2_id, name: connec_org2_name, last_push_to_external: "2014-08-10T14:42:38Z") }
567
+ #update idmap with last_push_to_external and check that the :missing_field is not updated
568
+ it 'does not overwrite the default field in the subsequent mapping' do
569
+ expect_any_instance_of(Entities::CustomerAndSupplierMissingField).to receive(:push_entities_to_external).with({'CompOrganizationMissingField' => {'CompSupplierMissingField' => [{entity: mapped_connec_org1.with_indifferent_access, idmap: org1_missing_field_idmap, id_refs_only_connec_entity: {}}], 'CompCustomerMissingField' => [{entity: mapped_connec_org2.with_indifferent_access, idmap: org2_missing_field_idmap, id_refs_only_connec_entity: {}}]}})
570
+ expect_any_instance_of(Entities::CustomerAndSupplierMissingField).to receive(:push_entities_to_connec).with({'CompCustomerMissingField' => {'CompOrganizationMissingField' => [{entity: mapped_ext_customer.with_indifferent_access, idmap: customer_missing_field_idmap}]}, 'CompSupplierMissingField' => {'CompOrganizationMissingField' => [{entity: mapped_ext_supplier.with_indifferent_access, idmap: supplier_missing_field_idmap}]}})
571
+ subject_already_pushed_entities
572
+ end
573
+ end
574
+ end
281
575
  end
@@ -27,8 +27,18 @@ describe 'connec to the external application' do
27
27
  entity['ID']
28
28
  end
29
29
 
30
+ def before_sync(last_synchronization_date)
31
+ @elephant_count = 8
32
+ end
33
+
30
34
  class PersonMapper
31
35
  extend HashMapper
36
+
37
+ after_normalize do |input, output, opts|
38
+ output[:Count] = opts[:elephant_count]
39
+ output
40
+ end
41
+
32
42
  map from('organization_id'), to('AccountId')
33
43
  map from('first_name'), to('FirstName')
34
44
  end
@@ -41,13 +51,17 @@ describe 'connec to the external application' do
41
51
  let(:external_client) { Object.new }
42
52
  let(:ext_org_id) { 'ext org id' }
43
53
  let(:ext_contact_id) { 'ext contact id' }
54
+ let(:ext_contact_id2) { 'ext contact id 2' }
55
+ let(:connec_id1) { "23daf041-e18e-0133-7b6a-15461b913fab"}
56
+ let(:connec_id2) { "11daf041-e18e-0133-7b6a-15461b913yyy"}
57
+
44
58
  let(:person1) {
45
59
  {
46
60
  "id" => [
47
61
  {
48
62
  "realm" => "org-fg4a",
49
63
  "provider" => "connec",
50
- "id" => "23daf041-e18e-0133-7b6a-15461b913fab"
64
+ "id" => connec_id1
51
65
  }
52
66
  ],
53
67
  "code" => "PE3",
@@ -75,13 +89,12 @@ describe 'connec to the external application' do
75
89
  }
76
90
  let(:person) { person1 }
77
91
 
78
-
79
- before {
92
+ before do
80
93
  allow(connec_client).to receive(:get).and_return(ActionDispatch::Response.new(200, {}, {people: [person]}.to_json, {}))
81
94
  allow(connec_client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: [{status: 200, body: {people: {}}}]}.to_json, {}))
82
95
 
83
96
  allow_any_instance_of(Entities::ConnecToExternal).to receive(:get_external_entities).and_return([])
84
- }
97
+ end
85
98
 
86
99
  subject { Maestrano::Connector::Rails::SynchronizationJob.new.sync_entity('connec_to_external', organization, connec_client, external_client, organization.last_synchronization_date, {}) }
87
100
 
@@ -93,7 +106,8 @@ describe 'connec to the external application' do
93
106
  let(:mapped_entity) {
94
107
  {
95
108
  AccountId: ext_org_id,
96
- FirstName: 'John'
109
+ FirstName: 'John',
110
+ Count: 8
97
111
  }
98
112
  }
99
113
 
@@ -102,8 +116,8 @@ describe 'connec to the external application' do
102
116
  :sequential=>true,
103
117
  :ops=> [
104
118
  {
105
- :method=>"put",
106
- :url=>"/api/v2/#{organization.uid}/people/23daf041-e18e-0133-7b6a-15461b913fab",
119
+ :method=>"put",
120
+ :url=>"/api/v2/#{organization.uid}/people/23daf041-e18e-0133-7b6a-15461b913fab",
107
121
  :params=>
108
122
  {
109
123
  :people=>{
@@ -157,7 +171,8 @@ describe 'connec to the external application' do
157
171
  let(:mapped_entity) {
158
172
  {
159
173
  AccountId: ext_org_id,
160
- FirstName: 'Jane'
174
+ FirstName: 'Jane',
175
+ Count: 8
161
176
  }
162
177
  }
163
178
 
@@ -177,12 +192,11 @@ describe 'connec to the external application' do
177
192
  expect(connec_client).to_not receive(:batch)
178
193
  subject
179
194
  end
180
-
181
195
  end
182
196
 
183
197
  describe 'a creation from connec with references missing' do
184
198
  let(:person) { person1.merge("organization_id" => [{"realm"=>"org-fg4a", "provider"=>"connec", "id"=>"2305c5e0-e18e-0133-890f-07d4de9f9781"}]) }
185
-
199
+
186
200
  it 'pushes nothing and creates no idmap' do
187
201
  expect_any_instance_of(Entities::ConnecToExternal).to_not receive(:create_external_entity)
188
202
  expect_any_instance_of(Entities::ConnecToExternal).to_not receive(:update_external_entity)
@@ -211,4 +225,97 @@ describe 'connec to the external application' do
211
225
  }.to_not change{ Maestrano::Connector::Rails::IdMap.count }
212
226
  end
213
227
  end
228
+
229
+ describe 'a creation from connec where the creation_only_mapper has to be used' do
230
+ #idmap.last_push_to_external is nil
231
+ before do
232
+ allow_any_instance_of(Entities::ConnecToExternalMissingField).to receive(:get_external_entities).and_return([])
233
+ end
234
+
235
+ subject { Maestrano::Connector::Rails::SynchronizationJob.new.sync_entity('connec_to_external_missing_field', organization, connec_client, external_client, organization.last_synchronization_date, {}) }
236
+
237
+ class Entities::ConnecToExternalMissingField < Entities::ConnecToExternal
238
+
239
+ def self.creation_mapper_class
240
+ CreationPersonMapper
241
+ end
242
+
243
+ class CreationPersonMapper < PersonMapper
244
+ after_normalize do |input, output|
245
+ output[:missing_connec_field] = "Default"
246
+ output
247
+ end
248
+ end
249
+ end
250
+
251
+ describe 'a new record created in connec with all references known' do
252
+ before {
253
+ allow(connec_client).to receive(:get).and_return(ActionDispatch::Response.new(200, {}, {people: [person2]}.to_json, {}))
254
+ allow(connec_client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: [{status: 200, body: {people: {}}}]}.to_json, {}))
255
+
256
+ allow_any_instance_of(Entities::ConnecToExternalMissingField).to receive(:create_external_entity).and_return({'ID' => ext_contact_id2})
257
+ }
258
+
259
+ let(:person2) { person1.merge('first_name' => 'Jack', 'id' => [{"realm" => "org-fg4a", "provider" => "connec", "id" => connec_id2 }]) }
260
+
261
+ let(:mapped_entity_missing_field) {
262
+ {
263
+ AccountId: ext_org_id,
264
+ FirstName: 'Jack',
265
+ missing_connec_field: "Default",
266
+ Count: 8
267
+ }
268
+ }
269
+
270
+ let(:batch_params) {
271
+ {
272
+ :sequential=>true,
273
+ :ops=> [
274
+ {
275
+ :method=>"put",
276
+ :url=>"/api/v2/#{organization.uid}/people/11daf041-e18e-0133-7b6a-15461b913yyy",
277
+ :params=>
278
+ {
279
+ :people=>{
280
+ id: [
281
+ {
282
+ :id=>"ext contact id 2",
283
+ :provider=>"provider",
284
+ :realm=>"oauth uid"
285
+ }
286
+ ]
287
+ }
288
+ }
289
+ }
290
+ ]
291
+ }
292
+ }
293
+
294
+ it 'handles the idmap correctly' do
295
+ expect{
296
+ subject
297
+ }.to change{ Maestrano::Connector::Rails::IdMap.count }.by(1)
298
+ idmap = Maestrano::Connector::Rails::IdMap.last
299
+ expect(idmap.name).to eql('Jack')
300
+ expect(idmap.connec_entity).to eql('person')
301
+ expect(idmap.external_entity).to eql('contact')
302
+ expect(idmap.message).to be_nil
303
+ expect(idmap.external_id).to eql(ext_contact_id2)
304
+ expect(idmap.connec_id).to eql("11daf041-e18e-0133-7b6a-15461b913yyy")
305
+ end
306
+
307
+ it 'does the mapping correctly' do
308
+ idmap = Entities::ConnecToExternalMissingField.create_idmap(organization_id: organization.id, external_id: ext_contact_id, connec_id: "23daf041-e18e-0133-7b6a-15461b913yyy")
309
+ allow(Entities::ConnecToExternalMissingField).to receive(:find_or_create_idmap).and_return(idmap)
310
+ expect_any_instance_of(Entities::ConnecToExternalMissingField).to receive(:push_entities_to_external).with([{entity: mapped_entity_missing_field.with_indifferent_access, idmap: idmap, id_refs_only_connec_entity: {}}])
311
+ subject
312
+ end
313
+
314
+ it 'send the external id to connec' do
315
+ expect(connec_client).to receive(:batch).with(batch_params)
316
+ subject
317
+ end
318
+ end
319
+
320
+ end
214
321
  end