maestrano-connector-rails 2.0.2.pre.RC6 → 2.0.2.pre.RC7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/DEVELOPER.md +1 -4
- data/Gemfile +2 -32
- data/Rakefile +6 -30
- data/app/models/maestrano/connector/rails/concerns/entity.rb +12 -0
- data/app/models/maestrano/connector/rails/concerns/sub_entity_base.rb +3 -2
- data/app/models/maestrano/connector/rails/id_map.rb +1 -0
- data/app/models/maestrano/connector/rails/services/data_consolidator.rb +4 -4
- data/db/migrate/20170315032224_add_metadata_to_id_map.rb +5 -0
- data/lib/maestrano/connector/rails/version.rb +7 -0
- data/lib/maestrano_connector_rails/factories.rb +1 -0
- data/maestrano-connector-rails.gemspec +44 -308
- metadata +13 -151
- data/VERSION +0 -1
- data/spec/controllers/connec_controller_spec.rb +0 -179
- data/spec/controllers/dependancies_controller_spec.rb +0 -31
- data/spec/controllers/group_users_controller_spec.rb +0 -39
- data/spec/controllers/groups_controller_spec.rb +0 -36
- data/spec/controllers/synchronizations_controller_spec.rb +0 -211
- data/spec/controllers/version_controller_spec.rb +0 -17
- data/spec/dummy/README.md +0 -1
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/application_controller.rb +0 -8
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/entities/.keep +0 -0
- data/spec/dummy/app/views/home/index.html.erb +0 -1
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/bin/setup +0 -29
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -26
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -39
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/maestrano.rb +0 -2
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -9
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/config/settings.yml +0 -2
- data/spec/dummy/config/settings/development.yml +0 -12
- data/spec/dummy/config/settings/production.yml +0 -1
- data/spec/dummy/config/settings/test.yml +0 -12
- data/spec/dummy/config/settings/uat.yml +0 -1
- data/spec/dummy/db/schema.rb +0 -102
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/.gitkeep +0 -0
- data/spec/integration/complex_id_references_spec.rb +0 -249
- data/spec/integration/complex_naming_spec.rb +0 -192
- data/spec/integration/complex_spec.rb +0 -578
- data/spec/integration/connec_to_external_spec.rb +0 -327
- data/spec/integration/external_to_connec_spec.rb +0 -159
- data/spec/integration/id_references_spec.rb +0 -584
- data/spec/integration/singleton_spec.rb +0 -297
- data/spec/jobs/all_synchronizations_job_spec.rb +0 -24
- data/spec/jobs/push_to_connec_job_spec.rb +0 -111
- data/spec/jobs/push_to_connec_worker_spec.rb +0 -37
- data/spec/jobs/synchronization_job_spec.rb +0 -216
- data/spec/models/complex_entity_spec.rb +0 -407
- data/spec/models/connec_helper_spec.rb +0 -588
- data/spec/models/connector_logger_spec.rb +0 -26
- data/spec/models/entity_base_spec.rb +0 -20
- data/spec/models/entity_spec.rb +0 -1078
- data/spec/models/external_spec.rb +0 -27
- data/spec/models/id_map_spec.rb +0 -12
- data/spec/models/organization_spec.rb +0 -243
- data/spec/models/sub_entity_base_spec.rb +0 -155
- data/spec/models/synchronization_spec.rb +0 -106
- data/spec/models/user_organization_rel_spec.rb +0 -14
- data/spec/models/user_spec.rb +0 -15
- data/spec/routing/connec_routing_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -34
- data/template/Procfile +0 -2
- data/template/application-sample.yml +0 -13
- data/template/database.yml +0 -31
- data/template/gitignore +0 -23
- data/template/maestrano.rb +0 -2
- data/template/maestrano_connector_template.rb +0 -135
- data/template/routes.rb +0 -25
- data/template/rubocop.yml +0 -55
- data/template/settings/development.yml +0 -0
- data/template/settings/production.yml +0 -0
- data/template/settings/settings.yml +0 -2
- data/template/settings/test.yml +0 -0
- data/template/settings/uat.yml +0 -0
- data/template/sidekiq.rb +0 -9
- data/template/sidekiq.yml +0 -4
- data/template/spec_helper.rb +0 -24
data/spec/dummy/lib/assets/.keep
DELETED
File without changes
|
data/spec/dummy/log/.keep
DELETED
File without changes
|
data/spec/dummy/public/404.html
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/404.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
data/spec/dummy/public/422.html
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/422.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
data/spec/dummy/public/500.html
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/500.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>We're sorry, but something went wrong.</h1>
|
62
|
-
</div>
|
63
|
-
<p>If you are the application owner check the logs for more information.</p>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
</html>
|
File without changes
|
File without changes
|
@@ -1,249 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'complex id references' do
|
4
|
-
|
5
|
-
class Entities::IdPayment < Maestrano::Connector::Rails::ComplexEntity
|
6
|
-
def self.connec_entities_names
|
7
|
-
%w(IdPayment)
|
8
|
-
end
|
9
|
-
def self.external_entities_names
|
10
|
-
%w(IdBill)
|
11
|
-
end
|
12
|
-
def connec_model_to_external_model(connec_hash_of_entities)
|
13
|
-
{'IdPayment' => {'IdBill' => connec_hash_of_entities['IdPayment']}}
|
14
|
-
end
|
15
|
-
def external_model_to_connec_model(external_hash_of_entities)
|
16
|
-
{'IdBill' => {'IdPayment' => external_hash_of_entities['IdBill']}}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
module Entities::SubEntities
|
21
|
-
end
|
22
|
-
class Entities::SubEntities::IdPayment < Maestrano::Connector::Rails::SubEntityBase
|
23
|
-
def self.external?
|
24
|
-
false
|
25
|
-
end
|
26
|
-
def self.entity_name
|
27
|
-
'IdPayment'
|
28
|
-
end
|
29
|
-
def self.mapper_classes
|
30
|
-
{
|
31
|
-
'IdBill' => ::IdPaymentMapper
|
32
|
-
}
|
33
|
-
end
|
34
|
-
def self.object_name_from_connec_entity_hash(entity)
|
35
|
-
entity['title']
|
36
|
-
end
|
37
|
-
def self.references
|
38
|
-
{'IdBill' => {record_references: %w(organization_id), id_references: %w(lines/id)}}
|
39
|
-
end
|
40
|
-
def self.id_from_external_entity_hash(entity)
|
41
|
-
entity['ID']
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
class Entities::SubEntities::IdBill < Maestrano::Connector::Rails::SubEntityBase
|
46
|
-
def self.external?
|
47
|
-
true
|
48
|
-
end
|
49
|
-
def self.entity_name
|
50
|
-
'IdBill'
|
51
|
-
end
|
52
|
-
def self.mapper_classes
|
53
|
-
{'IdPayment' => ::IdPaymentMapper}
|
54
|
-
end
|
55
|
-
def self.id_from_external_entity_hash(entity)
|
56
|
-
entity['ID']
|
57
|
-
end
|
58
|
-
def self.references
|
59
|
-
{'IdPayment' => {record_references: %w(organization_id), id_references: %w(lines/id)}}
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class IdLineMapper
|
64
|
-
extend HashMapper
|
65
|
-
map from('id'), to('ID')
|
66
|
-
map from('amount'), to('Price')
|
67
|
-
end
|
68
|
-
|
69
|
-
class IdPaymentMapper
|
70
|
-
extend HashMapper
|
71
|
-
map from('title'), to('Title')
|
72
|
-
map from('organization_id'), to('AccountId')
|
73
|
-
map from('lines'), to('Line'), using: IdLineMapper
|
74
|
-
end
|
75
|
-
|
76
|
-
let(:provider) { 'provider' }
|
77
|
-
let(:oauth_uid) { 'oauth uid' }
|
78
|
-
let!(:organization) { create(:organization, oauth_provider: provider, oauth_uid: oauth_uid) }
|
79
|
-
let(:connec_client) { Maestrano::Connector::Rails::ConnecHelper.get_client(organization) }
|
80
|
-
let(:external_client) { Object.new }
|
81
|
-
let(:connec_payment_id) { '1205c5e0-e18e-0133-890f-07d4de9f9781' }
|
82
|
-
let(:connec_line_id1) { '3405c5e0-e18e-0133-890f-07d4de9f9781' }
|
83
|
-
let(:connec_line_id2) { '4505c5e0-e18e-0133-890f-07d4de9f9781' }
|
84
|
-
let(:ext_payment_id) { 'ext payment id' }
|
85
|
-
let(:ext_org_id) { 'ext org id' }
|
86
|
-
let(:ext_line_id1) { 'ext line id1' }
|
87
|
-
let(:ext_line_id2) { 'ext line id2' }
|
88
|
-
|
89
|
-
let(:payment_title) { 'This is a payment' }
|
90
|
-
|
91
|
-
before {
|
92
|
-
allow(Maestrano::Connector::Rails::External).to receive(:entities_list).and_return(%w(id_payment))
|
93
|
-
organization.reset_synchronized_entities(true)
|
94
|
-
|
95
|
-
allow(connec_client).to receive(:get).and_return(ActionDispatch::Response.new(200, {}, {idpayments: [connec_payment]}.to_json, {}))
|
96
|
-
allow(connec_client).to receive(:batch).and_return(ActionDispatch::Response.new(200, {}, {results: [{status: 200, body: {payments: {}}}]}.to_json, {}))
|
97
|
-
|
98
|
-
allow_any_instance_of(Entities::SubEntities::IdBill).to receive(:get_external_entities).and_return([])
|
99
|
-
}
|
100
|
-
|
101
|
-
subject { Maestrano::Connector::Rails::SynchronizationJob.new.sync_entity('id_payment', organization, connec_client, external_client, organization.last_synchronization_date, {}) }
|
102
|
-
|
103
|
-
describe 'a creation from connec' do
|
104
|
-
before {
|
105
|
-
allow_any_instance_of(Entities::SubEntities::IdPayment).to receive(:create_external_entity).and_return(entity_received_after_creation)
|
106
|
-
}
|
107
|
-
|
108
|
-
let(:connec_payment) {
|
109
|
-
{
|
110
|
-
'id' => [
|
111
|
-
{
|
112
|
-
'realm' => 'org-fg4a',
|
113
|
-
'provider' => 'connec',
|
114
|
-
'id' => connec_payment_id
|
115
|
-
}
|
116
|
-
],
|
117
|
-
'title' => payment_title,
|
118
|
-
'organization_id' => [
|
119
|
-
{
|
120
|
-
'realm' => 'org-fg4a',
|
121
|
-
'provider' => 'connec',
|
122
|
-
'id' => '2305c5e0-e18e-0133-890f-07d4de9f9781'
|
123
|
-
},
|
124
|
-
{
|
125
|
-
'realm' => oauth_uid,
|
126
|
-
'provider' => provider,
|
127
|
-
'id' => ext_org_id
|
128
|
-
}
|
129
|
-
],
|
130
|
-
'lines' => lines
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
|
-
let(:lines) {
|
135
|
-
[
|
136
|
-
{
|
137
|
-
'id' => [
|
138
|
-
{
|
139
|
-
'realm' => 'org-fg4a',
|
140
|
-
'provider' => 'connec',
|
141
|
-
'id' => connec_line_id1
|
142
|
-
}
|
143
|
-
],
|
144
|
-
'amount' => 123
|
145
|
-
},
|
146
|
-
{
|
147
|
-
'id' => [
|
148
|
-
{
|
149
|
-
'realm' => 'org-fg4a',
|
150
|
-
'provider' => 'connec',
|
151
|
-
'id' => connec_line_id2
|
152
|
-
}
|
153
|
-
],
|
154
|
-
'amount' => 456
|
155
|
-
}
|
156
|
-
]
|
157
|
-
}
|
158
|
-
|
159
|
-
let(:entity_received_after_creation) {
|
160
|
-
{
|
161
|
-
'ID' => ext_payment_id,
|
162
|
-
'Title' => payment_title,
|
163
|
-
'AccountId' => ext_org_id,
|
164
|
-
'Line' => [
|
165
|
-
{
|
166
|
-
'ID' => ext_line_id1,
|
167
|
-
'Price' => 123
|
168
|
-
},
|
169
|
-
{
|
170
|
-
'ID' => ext_line_id2,
|
171
|
-
'Price' => 456
|
172
|
-
}
|
173
|
-
]
|
174
|
-
}
|
175
|
-
}
|
176
|
-
|
177
|
-
let(:batch_params) {
|
178
|
-
{
|
179
|
-
:sequential=>true,
|
180
|
-
:ops=> [
|
181
|
-
{
|
182
|
-
:method=>"put",
|
183
|
-
:url=>"/api/v2/#{organization.uid}/idpayments/#{connec_payment_id}",
|
184
|
-
:params=>
|
185
|
-
{
|
186
|
-
:idpayments=>{
|
187
|
-
'id' => [
|
188
|
-
{
|
189
|
-
'id' => ext_payment_id,
|
190
|
-
'provider' =>provider,
|
191
|
-
'realm' =>oauth_uid
|
192
|
-
}
|
193
|
-
],
|
194
|
-
'lines' => [
|
195
|
-
{
|
196
|
-
'id' => [
|
197
|
-
{
|
198
|
-
'realm' => 'org-fg4a',
|
199
|
-
'provider' => 'connec',
|
200
|
-
'id' => connec_line_id1
|
201
|
-
},
|
202
|
-
{
|
203
|
-
'realm' => oauth_uid,
|
204
|
-
'provider' => provider,
|
205
|
-
'id' => ext_line_id1
|
206
|
-
}
|
207
|
-
]
|
208
|
-
},
|
209
|
-
{
|
210
|
-
'id' => [
|
211
|
-
{
|
212
|
-
'realm' => 'org-fg4a',
|
213
|
-
'provider' => 'connec',
|
214
|
-
'id' => connec_line_id2
|
215
|
-
},
|
216
|
-
{
|
217
|
-
'realm' => oauth_uid,
|
218
|
-
'provider' => provider,
|
219
|
-
'id' => ext_line_id2
|
220
|
-
}
|
221
|
-
]
|
222
|
-
}
|
223
|
-
]
|
224
|
-
}
|
225
|
-
}
|
226
|
-
}
|
227
|
-
]
|
228
|
-
}
|
229
|
-
}
|
230
|
-
|
231
|
-
it 'handles the idmap correctly' do
|
232
|
-
expect{
|
233
|
-
subject
|
234
|
-
}.to change{ Maestrano::Connector::Rails::IdMap.count }.by(1)
|
235
|
-
idmap = Maestrano::Connector::Rails::IdMap.last
|
236
|
-
expect(idmap.name).to eql(payment_title)
|
237
|
-
expect(idmap.connec_entity).to eql('idpayment')
|
238
|
-
expect(idmap.external_entity).to eql('idbill')
|
239
|
-
expect(idmap.message).to be_nil
|
240
|
-
expect(idmap.external_id).to eql(ext_payment_id)
|
241
|
-
expect(idmap.connec_id).to eql(connec_payment_id)
|
242
|
-
end
|
243
|
-
|
244
|
-
it 'send the external id to connec' do
|
245
|
-
expect(connec_client).to receive(:batch).with(batch_params)
|
246
|
-
subject
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|