esp_sdk 2.2.0 → 2.3.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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +8 -0
  4. data/Gemfile.lock +4 -1
  5. data/Rakefile +12 -1
  6. data/lib/esp/extensions/active_resource/formats/json_api_format.rb +1 -1
  7. data/lib/esp/extensions/active_resource/validations.rb +3 -2
  8. data/lib/esp/external_account_creator.rb +2 -2
  9. data/lib/esp/resources/custom_signature.rb +7 -0
  10. data/lib/esp/resources/report.rb +1 -1
  11. data/lib/esp/resources/reports/export/integration.rb +44 -0
  12. data/lib/esp/resources/team.rb +6 -0
  13. data/lib/esp/version.rb +1 -1
  14. data/lib/esp.rb +5 -0
  15. data/test/esp/extensions/active_resource/formats/json_api_format_test.rb +0 -67
  16. data/test/esp/extensions/active_resource/paginated_collection_test.rb +0 -69
  17. data/test/esp/extensions/active_resource/validations_test.rb +0 -20
  18. data/test/esp/integration/alert_integration_test.rb +96 -0
  19. data/test/esp/integration/cloud_trail_event_integration_test.rb +18 -0
  20. data/test/esp/integration/contact_request_integration_test.rb +21 -0
  21. data/test/esp/integration/custom_signature_integration_test.rb +97 -0
  22. data/test/esp/integration/dashboard_integration_test.rb +17 -0
  23. data/test/esp/integration/external_account_integration_test.rb +68 -0
  24. data/test/esp/integration/json_api_format_integration_test.rb +61 -0
  25. data/test/esp/integration/metadata_integration_test.rb +18 -0
  26. data/test/esp/integration/organization_integration_test.rb +81 -0
  27. data/test/esp/integration/paginated_collection_integration_test.rb +67 -0
  28. data/test/esp/integration/region_integration_test.rb +32 -0
  29. data/test/esp/integration/report_export_integration_integration_test.rb +24 -0
  30. data/test/esp/integration/report_integration_test.rb +71 -0
  31. data/test/esp/integration/resource_integration_test.rb +54 -0
  32. data/test/esp/integration/scan_interval_integration_test.rb +49 -0
  33. data/test/esp/integration/service_integration_test.rb +28 -0
  34. data/test/esp/integration/signature_integration_test.rb +62 -0
  35. data/test/esp/integration/stat_custom_signature_integration_test.rb +22 -0
  36. data/test/esp/integration/stat_integration_test.rb +69 -0
  37. data/test/esp/integration/stat_region_integration_test.rb +36 -0
  38. data/test/esp/integration/stat_service_integration_test.rb +36 -0
  39. data/test/esp/integration/stat_signature_integration_test.rb +36 -0
  40. data/test/esp/integration/sub_organization_integration_test.rb +79 -0
  41. data/test/esp/integration/suppression_integration_test.rb +95 -0
  42. data/test/esp/integration/suppression_region_integration_test.rb +52 -0
  43. data/test/esp/integration/suppression_signature_integration_test.rb +52 -0
  44. data/test/esp/integration/suppression_unique_identifier_integration_test.rb +30 -0
  45. data/test/esp/integration/tag_integration_test.rb +18 -0
  46. data/test/esp/integration/team_integration_test.rb +87 -0
  47. data/test/esp/integration/user_integration_test.rb +52 -0
  48. data/test/esp/integration/validations_integration_test.rb +18 -0
  49. data/test/esp/resources/alert_test.rb +0 -93
  50. data/test/esp/resources/cloud_trail_event_test.rb +0 -20
  51. data/test/esp/resources/contact_request_test.rb +0 -23
  52. data/test/esp/resources/custom_signature_test.rb +14 -85
  53. data/test/esp/resources/dashboard_test.rb +0 -19
  54. data/test/esp/resources/external_account_test.rb +0 -67
  55. data/test/esp/resources/metadata_test.rb +0 -20
  56. data/test/esp/resources/organization_test.rb +0 -80
  57. data/test/esp/resources/region_test.rb +0 -31
  58. data/test/esp/resources/report_test.rb +0 -70
  59. data/test/esp/resources/reports/export/integration_test.rb +55 -0
  60. data/test/esp/resources/resource_test.rb +0 -53
  61. data/test/esp/resources/scan_interval_test.rb +0 -50
  62. data/test/esp/resources/service_test.rb +0 -27
  63. data/test/esp/resources/signature_test.rb +0 -60
  64. data/test/esp/resources/stat_custom_signature_test.rb +0 -22
  65. data/test/esp/resources/stat_region_test.rb +1 -36
  66. data/test/esp/resources/stat_service_test.rb +1 -36
  67. data/test/esp/resources/stat_signature_test.rb +0 -36
  68. data/test/esp/resources/stat_test.rb +0 -68
  69. data/test/esp/resources/sub_organization_test.rb +0 -78
  70. data/test/esp/resources/suppression/region_test.rb +0 -50
  71. data/test/esp/resources/suppression/signature_test.rb +0 -50
  72. data/test/esp/resources/suppression/unique_identifier_test.rb +0 -30
  73. data/test/esp/resources/suppression_test.rb +0 -94
  74. data/test/esp/resources/tag_test.rb +0 -20
  75. data/test/esp/resources/team_test.rb +14 -78
  76. data/test/esp/resources/user_test.rb +0 -47
  77. data/test/factories/custom_signatures.rb +17 -7
  78. data/test/factories/teams.rb +18 -8
  79. data/test/parallel_reporter.rb +93 -0
  80. data/test/test_helper.rb +20 -4
  81. metadata +70 -3
@@ -225,99 +225,6 @@ module ESP
225
225
  end
226
226
  end
227
227
  end
228
-
229
- context 'live calls' do
230
- setup do
231
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
232
- WebMock.allow_net_connect!
233
- @report = ESP::Report.all.detect { |r| r.status == 'complete' }
234
- skip "Live DB does not have any reports. Add a report and run tests again." if @report.blank?
235
- @alert = @report.alerts.last
236
- end
237
-
238
- teardown do
239
- WebMock.disable_net_connect!
240
- end
241
-
242
- context '#external_account' do
243
- should 'return an external_account' do
244
- external_account = @alert.external_account
245
-
246
- assert_equal ESP::ExternalAccount, external_account.class
247
- assert_equal @alert.external_account_id, external_account.id
248
- end
249
- end
250
-
251
- context '#region' do
252
- should 'return a region' do
253
- region = @alert.region
254
-
255
- assert_equal ESP::Region, region.class
256
- assert_equal @alert.region_id, region.id
257
- end
258
- end
259
-
260
- context '#signature' do
261
- should 'return a signature' do
262
- signature = @alert.signature
263
-
264
- assert_equal ESP::Signature, signature.class
265
- assert_equal @alert.signature_id, signature.id
266
- end
267
- end
268
-
269
- context '#custom_signature' do
270
- should 'return a custom_signature' do
271
- assert_nothing_raised do
272
- @alert.attributes['custom_signature_id'] ||= 1
273
- @alert.custom_signature
274
- end
275
- end
276
- end
277
-
278
- context '#suppression' do
279
- should 'return a suppression' do
280
- assert_nothing_raised do
281
- @alert.attributes['suppression_id'] ||= 1
282
- @alert.suppression
283
- end
284
- end
285
- end
286
-
287
- context '#cloud_trail_events' do
288
- should 'return cloud_trail_events' do
289
- assert_nothing_raised do
290
- @alert.cloud_trail_events
291
- end
292
- end
293
- end
294
-
295
- context '#tags' do
296
- should 'return tags' do
297
- assert_nothing_raised do
298
- @alert.tags
299
- end
300
- end
301
- end
302
-
303
- context '.find' do
304
- should 'return an alert by id' do
305
- alert = ESP::Alert.find(@alert.id.to_i)
306
-
307
- assert_equal ESP::Alert, alert.class
308
- assert_equal @alert.id, alert.id
309
- end
310
- end
311
-
312
- context '.where' do
313
- should 'return alert objects' do
314
- alerts = ESP::Alert.where(report_id: @report.id, id_eq: @alert.id)
315
-
316
- assert_equal ESP::Alert, alerts.resource_class
317
- assert_equal @alert.id, alerts.first.id
318
- end
319
- end
320
- end
321
228
  end
322
229
  end
323
230
  end
@@ -81,26 +81,6 @@ module ESP
81
81
  assert_equal ESP::CloudTrailEvent, events.resource_class
82
82
  end
83
83
  end
84
-
85
- context 'live calls' do
86
- setup do
87
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
88
- WebMock.allow_net_connect!
89
- end
90
-
91
- teardown do
92
- WebMock.disable_net_connect!
93
- end
94
-
95
- context '.for_alert' do
96
- should 'return events for alert id' do
97
- report = ESP::Report.all.detect { |r| r.status == 'complete' }
98
- events = ESP::CloudTrailEvent.for_alert(report.alerts.last.id)
99
-
100
- assert_equal ESP::CloudTrailEvent, events.resource_class
101
- end
102
- end
103
- end
104
84
  end
105
85
  end
106
86
  end
@@ -53,29 +53,6 @@ module ESP
53
53
  assert_equal ESP::ContactRequest, contact_request.class
54
54
  end
55
55
  end
56
-
57
- context 'live calls' do
58
- setup do
59
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
60
- WebMock.allow_net_connect!
61
- end
62
-
63
- teardown do
64
- WebMock.disable_net_connect!
65
- end
66
-
67
- context '#CRUD' do
68
- should 'be able to create, update and destroy' do
69
- contact_request = ESP::ContactRequest.new(user_id: 5, request_type: 'feature', title: 'My great feature idea', description: 'This is my idea for a really useful feature...')
70
-
71
- assert_predicate contact_request, :new?
72
-
73
- contact_request.save
74
-
75
- refute_predicate contact_request, :new?
76
- end
77
- end
78
- end
79
56
  end
80
57
  end
81
58
  end
@@ -14,6 +14,20 @@ module ESP
14
14
  end
15
15
  end
16
16
 
17
+ context '#teams' do
18
+ should 'call the api' do
19
+ custom_signature = build(:custom_signature, team_id: 1)
20
+ stub_request(:put, /teams.json*/).to_return(body: json_list(:team, 2))
21
+
22
+ custom_signature.teams
23
+
24
+ assert_requested(:put, /teams.json*/) do |req|
25
+ body = JSON.parse(req.body)
26
+ assert_equal custom_signature.id, body['filter']['custom_signatures_id_eq']
27
+ end
28
+ end
29
+ end
30
+
17
31
  context '.run_sanity_test!' do
18
32
  should 'call the api and pass params' do
19
33
  custom_signature = build(:custom_signature, external_account_id: 3)
@@ -159,91 +173,6 @@ module ESP
159
173
  assert_equal ESP::Suppression::Signature, suppression.class
160
174
  end
161
175
  end
162
-
163
- context 'live calls' do
164
- setup do
165
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
166
- WebMock.allow_net_connect!
167
- @custom_signature = ESP::CustomSignature.last
168
- skip "Live DB does not have any custom_signatures. Add a custom_signature and run tests again." if @custom_signature.blank?
169
- end
170
-
171
- teardown do
172
- WebMock.disable_net_connect!
173
- end
174
-
175
- context '#organization' do
176
- should 'return an organization' do
177
- organization = @custom_signature.organization
178
-
179
- assert_equal @custom_signature.organization_id, organization.id
180
- assert_equal ESP::Organization, organization.class
181
- end
182
- end
183
-
184
- context '.run' do
185
- should 'return alerts' do
186
- external_account_id = ESP::ExternalAccount.last.id
187
- alerts = ESP::CustomSignature.run(external_account_id: external_account_id, regions: 'us_east_1', language: @custom_signature.language, signature: @custom_signature.signature)
188
-
189
- assert_equal ESP::Alert, alerts.resource_class
190
- end
191
-
192
- should 'return errors' do
193
- signature = ESP::CustomSignature.run(external_account_id: 999_999_999_999, regions: 'us_east_1', language: @custom_signature.language, signature: @custom_signature.signature)
194
-
195
- assert_equal "Couldn't find ExternalAccount", signature.errors.full_messages.first
196
- end
197
- end
198
-
199
- context '#run' do
200
- should 'return alerts' do
201
- external_account_id = ESP::ExternalAccount.last.id
202
- alerts = @custom_signature.run(external_account_id: external_account_id, regions: ['us_east_1'])
203
-
204
- assert_equal ESP::Alert, alerts.resource_class
205
- end
206
-
207
- should 'return errors' do
208
- @custom_signature.run(external_account_id: 999_999_999_999)
209
-
210
- assert_equal "Couldn't find ExternalAccount", @custom_signature.errors.full_messages.first
211
- end
212
- end
213
-
214
- context '.where' do
215
- should 'return custom_signature objects' do
216
- custom_signatures = ESP::CustomSignature.where(id_eq: @custom_signature.id)
217
-
218
- assert_equal ESP::CustomSignature, custom_signatures.resource_class
219
- end
220
- end
221
-
222
- context '#CRUD' do
223
- should 'be able to create, update and destroy' do
224
- custom_signature = ESP::CustomSignature.new(@custom_signature.attributes)
225
-
226
- assert_predicate custom_signature, :new?
227
-
228
- custom_signature.save
229
-
230
- refute_predicate custom_signature, :new?
231
-
232
- custom_signature.identifier = 'new identifier'
233
- custom_signature.save
234
-
235
- assert_nothing_raised do
236
- ESP::CustomSignature.find(custom_signature.id)
237
- end
238
-
239
- custom_signature.destroy
240
-
241
- assert_raises ActiveResource::ResourceNotFound do
242
- ESP::CustomSignature.find(custom_signature.id)
243
- end
244
- end
245
- end
246
- end
247
176
  end
248
177
  end
249
178
  end
@@ -55,25 +55,6 @@ module ESP
55
55
  assert_equal ESP::Dashboard, dashboard.resource_class
56
56
  end
57
57
  end
58
-
59
- context 'live calls' do
60
- setup do
61
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
62
- WebMock.allow_net_connect!
63
- end
64
-
65
- teardown do
66
- WebMock.disable_net_connect!
67
- end
68
-
69
- context '.recent' do
70
- should 'return an array of contact_requests' do
71
- dashboards = ESP::Dashboard.recent
72
-
73
- assert_equal ESP::Dashboard, dashboards.resource_class
74
- end
75
- end
76
- end
77
58
  end
78
59
  end
79
60
  end
@@ -72,73 +72,6 @@ module ESP
72
72
  assert_received(ESP::ExternalAccount.any_instance, :generate_external_id)
73
73
  end
74
74
  end
75
-
76
- context 'live calls' do
77
- setup do
78
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
79
- WebMock.allow_net_connect!
80
- @external_account = ESP::ExternalAccount.last
81
- skip "Live DB does not have any external_accounts. Add a external_account and run tests again." if @external_account.blank?
82
- end
83
-
84
- teardown do
85
- WebMock.disable_net_connect!
86
- end
87
-
88
- context '#organization' do
89
- should 'return an organization' do
90
- org = @external_account.organization
91
-
92
- assert_equal @external_account.organization_id, org.id
93
- end
94
- end
95
-
96
- context '#sub_organization' do
97
- should 'return a sub_organization' do
98
- sub_org = @external_account.sub_organization
99
-
100
- assert_equal @external_account.sub_organization_id, sub_org.id
101
- end
102
- end
103
-
104
- context '#team' do
105
- should 'return a team' do
106
- team = @external_account.team
107
-
108
- assert_equal ESP::Team, team.class
109
- end
110
- end
111
-
112
- context '.where' do
113
- should 'return external_account objects' do
114
- external_accounts = ESP::ExternalAccount.where(id_eq: @external_account.id)
115
-
116
- assert_equal ESP::ExternalAccount, external_accounts.resource_class
117
- end
118
- end
119
-
120
- context '#CRUD' do
121
- should 'be able to create, update and destroy' do
122
- skip "There are to many dependencies to validate an external account to create or update one. Besides esp_web, esp_query has to be running and there must be valid AWS keys assigned as well."
123
-
124
- external_account = ESP::ExternalAccount.create(name: 'bob', arn: @external_account.arn, sub_organization_id: @external_account.sub_organization_id, team_id: @external_account.team_id)
125
-
126
- assert_predicate external_account, :new?
127
- assert_contains external_account.errors, "The account for this ARN is already being checked by Dev"
128
-
129
- refute_predicate @external_account, :new?
130
- @external_account.name = @external_account.name
131
-
132
- assert_predicate @external_account, :save
133
-
134
- external_account = build(:external_account, id: 999)
135
-
136
- assert_raises ActiveResource::ResourceNotFound do
137
- external_account.destroy
138
- end
139
- end
140
- end
141
- end
142
75
  end
143
76
  end
144
77
  end
@@ -73,26 +73,6 @@ module ESP
73
73
  assert_equal ESP::Metadata, metadata.class
74
74
  end
75
75
  end
76
-
77
- context 'live calls' do
78
- setup do
79
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
80
- WebMock.allow_net_connect!
81
- end
82
-
83
- teardown do
84
- WebMock.disable_net_connect!
85
- end
86
-
87
- context '.for_alert' do
88
- should 'return metadata for alert id' do
89
- report = ESP::Report.all.detect { |r| r.status == 'complete' }
90
- metadata = ESP::Metadata.for_alert(report.alerts.last.id)
91
-
92
- assert_equal ESP::Metadata, metadata.class
93
- end
94
- end
95
- end
96
76
  end
97
77
  end
98
78
  end
@@ -98,86 +98,6 @@ module ESP
98
98
  end
99
99
  end
100
100
  end
101
-
102
- context 'live calls' do
103
- setup do
104
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
105
- WebMock.allow_net_connect!
106
- @organization = ESP::Organization.last
107
- skip "Live DB does not have any sub organizations. Add a sub organization and run tests again." if @organization.blank?
108
- end
109
-
110
- teardown do
111
- WebMock.disable_net_connect!
112
- end
113
-
114
- context '#teams' do
115
- should 'return teams' do
116
- teams = @organization.teams
117
-
118
- assert_equal ESP::Team, teams.resource_class
119
- end
120
- end
121
-
122
- context '#sub_organizations' do
123
- should 'return a sub_organization' do
124
- sub_organizations = @organization.sub_organizations
125
-
126
- assert_equal ESP::SubOrganization, sub_organizations.resource_class
127
- end
128
- end
129
-
130
- context '#users' do
131
- should 'return an array of users' do
132
- users = @organization.users
133
-
134
- assert_equal ESP::User, users.resource_class
135
- end
136
- end
137
-
138
- context '#reports' do
139
- should 'return an array of reports' do
140
- reports = @organization.reports
141
-
142
- assert_equal ESP::Report, reports.resource_class
143
- end
144
- end
145
-
146
- context '#external_accounts' do
147
- should 'return an array of external_accounts' do
148
- external_accounts = @organization.external_accounts
149
-
150
- assert_equal ESP::ExternalAccount, external_accounts.resource_class
151
- end
152
- end
153
-
154
- context '#custom_signatures' do
155
- should 'return an array of custom_signatures' do
156
- custom_signatures = @organization.custom_signatures
157
-
158
- assert_equal ESP::CustomSignature, custom_signatures.resource_class
159
- end
160
- end
161
-
162
- context '.where' do
163
- should 'return organization objects' do
164
- organizations = ESP::Organization.where(id_eq: @organization.id)
165
-
166
- assert_equal ESP::Organization, organizations.resource_class
167
- end
168
- end
169
-
170
- context '#CRUD' do
171
- should 'be able to update' do
172
- @organization.name = @organization.name
173
- @organization.save
174
-
175
- assert_nothing_raised do
176
- ESP::Organization.find(@organization.id)
177
- end
178
- end
179
- end
180
- end
181
101
  end
182
102
  end
183
103
  end
@@ -56,37 +56,6 @@ module ESP
56
56
  assert_equal ESP::Suppression::Region, suppression.class
57
57
  end
58
58
  end
59
-
60
- context 'live calls' do
61
- setup do
62
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
63
- WebMock.allow_net_connect!
64
- @region = ESP::Region.last
65
- skip "Live DB does not have any regions. Add a region and run tests again." if @region.blank?
66
- end
67
-
68
- teardown do
69
- WebMock.disable_net_connect!
70
- end
71
-
72
- context '.where' do
73
- should 'return region objects' do
74
- regions = ESP::Region.where(id_eq: @region.id)
75
-
76
- assert_equal ESP::Region, regions.resource_class
77
- end
78
- end
79
-
80
- context '#CRUD' do
81
- should 'be able to read' do
82
- assert_not_nil @region
83
-
84
- region = ESP::Region.find(@region.id)
85
-
86
- assert_not_nil region
87
- end
88
- end
89
- end
90
59
  end
91
60
  end
92
61
  end
@@ -114,76 +114,6 @@ module ESP
114
114
  end
115
115
  end
116
116
  end
117
-
118
- context 'live calls' do
119
- setup do
120
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
121
- WebMock.allow_net_connect!
122
- @report = ESP::Report.all.detect { |r| r.status == 'complete' }
123
- skip "Live DB does not have any reports. Add a report and run tests again." if @report.blank?
124
- end
125
-
126
- teardown do
127
- WebMock.disable_net_connect!
128
- end
129
-
130
- context '#organization' do
131
- should 'return an organization' do
132
- org = @report.organization
133
-
134
- assert_equal @report.organization_id, org.id
135
- end
136
- end
137
-
138
- context '#sub_organization' do
139
- should 'return a sub_organization' do
140
- sub_org = @report.sub_organization
141
-
142
- assert_equal @report.sub_organization_id, sub_org.id
143
- end
144
- end
145
-
146
- context '#team' do
147
- should 'return a team' do
148
- team = @report.team
149
-
150
- assert_equal ESP::Team, team.class
151
- end
152
- end
153
-
154
- context '#alerts' do
155
- should 'return an array of alerts' do
156
- alerts = @report.alerts
157
-
158
- assert_equal ESP::Alert, alerts.resource_class
159
- end
160
- end
161
-
162
- context '#stat' do
163
- should 'return a stat' do
164
- stat = @report.stat
165
-
166
- assert_equal ESP::Stat, stat.class
167
- end
168
- end
169
-
170
- context '.where' do
171
- should 'return report objects' do
172
- reports = ESP::Report.where(id_eq: @report.id)
173
-
174
- assert_equal ESP::Report, reports.resource_class
175
- end
176
- end
177
-
178
- context '.create' do
179
- should 'return an error if a bad team_id is passed' do
180
- assert_nothing_raised do
181
- r = ESP::Report.create(team_id: 999)
182
- assert_equal "Couldn't find Team", r.errors.full_messages.first
183
- end
184
- end
185
- end
186
- end
187
117
  end
188
118
  end
189
119
  end
@@ -0,0 +1,55 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper')
2
+
3
+ module ESP
4
+ class Report
5
+ module Export
6
+ class IntegrationTest < ActiveSupport::TestCase
7
+ context ESP::Report::Export::Integration do
8
+ context '.where' do
9
+ should 'not be implemented' do
10
+ assert_raises ESP::NotImplementedError do
11
+ ESP::Report::Export::Integration.where(id_eq: 2)
12
+ end
13
+ end
14
+ end
15
+
16
+ context '#find' do
17
+ should 'not be implemented' do
18
+ assert_raises ESP::NotImplementedError do
19
+ ESP::Report::Export::Integration.find(4)
20
+ end
21
+ end
22
+ end
23
+
24
+ context '#update' do
25
+ should 'not be implemented' do
26
+ s = ESP::Report::Export::Integration.new
27
+ assert_raises ESP::NotImplementedError do
28
+ s.update
29
+ end
30
+ end
31
+ end
32
+
33
+ context '#destroy' do
34
+ should 'not be implemented' do
35
+ s = ESP::Report::Export::Integration.new
36
+ assert_raises ESP::NotImplementedError do
37
+ s.destroy
38
+ end
39
+ end
40
+ end
41
+
42
+ context '#create' do
43
+ should 'call the api' do
44
+ stub_request(:post, %r{reports/export/integrations.json*}).to_return(body: { success: 'Your export has been started' }.to_json)
45
+
46
+ ESP::Report::Export::Integration.create(integration_id: 1, region_ids: [1])
47
+
48
+ assert_requested(:post, %r{reports/export/integrations.json*})
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end