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
@@ -278,59 +278,6 @@ module ESP
278
278
  end
279
279
  end
280
280
  end
281
-
282
- context 'live calls' do
283
- setup do
284
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
285
- WebMock.allow_net_connect!
286
- @team = ESP::Team.last
287
- skip "Live DB does not have any teams. Add a team and run tests again." if @team.blank?
288
- end
289
-
290
- teardown do
291
- WebMock.disable_net_connect!
292
- end
293
-
294
- context 'with ESP::Team' do
295
- context '.find' do
296
- should 'find a team' do
297
- t = ESP::Team.find(@team.id)
298
-
299
- assert_equal ESP::Team, t.class
300
- assert_equal @team.id, t.id
301
- end
302
-
303
- should 'find teams' do
304
- t = ESP::Team.find(:all, params: { id: @team.id })
305
-
306
- assert_equal ESP::Team, t.resource_class
307
- assert_equal 1, t.count
308
- end
309
- end
310
-
311
- context '.where' do
312
- should 'return teams' do
313
- teams = ESP::Team.where(id: @team.id)
314
-
315
- assert_equal ESP::Team, teams.resource_class
316
- assert_equal 1, teams.count
317
- end
318
-
319
- should 'return included object on first call' do
320
- teams = ESP::Team.where(id: @team.id, include: 'organization')
321
-
322
- assert_equal ESP::Organization, teams.first.attributes['organization'].class
323
- end
324
-
325
- should 'return multiple included objects on first call' do
326
- teams = ESP::Team.where(id: @team.id, include: 'sub_organization, organization')
327
-
328
- assert_equal ESP::Organization, teams.first.attributes['organization'].class
329
- assert_equal ESP::SubOrganization, teams.first.attributes['sub_organization'].class
330
- end
331
- end
332
- end
333
- end
334
281
  end
335
282
  end
336
283
  end
@@ -69,56 +69,6 @@ module ESP
69
69
  assert_equal ESP::ScanInterval, scan_interval.resource_class
70
70
  end
71
71
  end
72
-
73
- context 'live calls' do
74
- setup do
75
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
76
- WebMock.allow_net_connect!
77
- @external_account = ESP::ExternalAccount.last
78
- @service = ESP::Service.last
79
- skip "Live DB does not have any external_accounts. Add an external_account and run tests again." if @external_account.blank?
80
- skip "Live DB does not have any services. Add an service and run tests again." if @service.blank?
81
- end
82
-
83
- teardown do
84
- # destroy record incase of failure
85
- @scan_interval.destroy rescue nil # rubocop:disable Style/RescueModifier
86
- WebMock.disable_net_connect!
87
- end
88
-
89
- context '#CRUD' do
90
- should 'be able to create, update and destroy' do
91
- @scan_interval = ESP::ScanInterval.new(interval: 15, service_id: @service.id, external_account_id: @external_account.id)
92
-
93
- # Create
94
- assert_predicate @scan_interval, :new?
95
- @scan_interval.save
96
- refute_predicate @scan_interval, :new?
97
-
98
- # Update
99
- @scan_interval.interval = 30
100
- @scan_interval.save
101
- assert_nothing_raised do
102
- ESP::ScanInterval.find(@scan_interval.id.to_i)
103
- end
104
-
105
- # Service Relationship
106
- service = @scan_interval.service
107
- assert_equal service.id, @service.id
108
-
109
- # External Account Relationship
110
- external_account = @scan_interval.external_account
111
- assert_equal external_account.id, @external_account.id
112
-
113
- # Destroy
114
- @scan_interval.destroy
115
-
116
- assert_raises ActiveResource::ResourceNotFound do
117
- ESP::ScanInterval.find(@scan_interval.id.to_i)
118
- end
119
- end
120
- end
121
- end
122
72
  end
123
73
  end
124
74
  end
@@ -40,33 +40,6 @@ module ESP
40
40
  end
41
41
  end
42
42
  end
43
-
44
- context 'live calls' do
45
- setup do
46
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
47
- WebMock.allow_net_connect!
48
- @service = ESP::Service.last
49
- skip "Live DB does not have any services. Add a service and run tests again." if @service.blank?
50
- end
51
-
52
- teardown do
53
- WebMock.disable_net_connect!
54
- end
55
-
56
- context '#signatures' do
57
- should 'return an array of signatures' do
58
- signatures = @service.signatures
59
-
60
- assert_equal ESP::Signature, signatures.resource_class
61
- end
62
- end
63
-
64
- context '#CRUD' do
65
- should 'be able to read' do
66
- assert_not_nil @service, @service.inspect
67
- end
68
- end
69
- end
70
43
  end
71
44
  end
72
45
  end
@@ -118,66 +118,6 @@ module ESP
118
118
  assert_equal ESP::Suppression::Signature, suppression.class
119
119
  end
120
120
  end
121
-
122
- context 'live calls' do
123
- setup do
124
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
125
- WebMock.allow_net_connect!
126
- @signature = ESP::Signature.where(name_cont: 'heartbleed').last
127
- skip "Live DB does not have any signatures. Add a signature and run tests again." if @signature.blank?
128
- end
129
-
130
- teardown do
131
- WebMock.disable_net_connect!
132
- end
133
-
134
- context '#service' do
135
- should 'return a service' do
136
- service = @signature.service
137
-
138
- assert_equal @signature.service_id, service.id
139
- assert_equal ESP::Service, service.class
140
- end
141
- end
142
-
143
- context '#run' do
144
- should 'return alerts' do
145
- external_account_id = ESP::ExternalAccount.last.id
146
-
147
- alerts = @signature.run(external_account_id: external_account_id, region: 'us_east_1')
148
-
149
- assert_equal ESP::Alert, alerts.resource_class
150
- end
151
-
152
- should 'return errors' do
153
- external_account_id = 999_999_999_999
154
-
155
- @signature.run(external_account_id: external_account_id, region: 'us_east_1')
156
-
157
- assert_equal "Couldn't find ExternalAccount", @signature.errors.full_messages.first
158
- end
159
- end
160
-
161
- context '.where' do
162
- should 'return signature objects' do
163
- signatures = ESP::Signature.where(id_eq: @signature.id)
164
-
165
- assert_equal ESP::Signature, signatures.resource_class
166
- end
167
- end
168
-
169
- context '#CRUD' do
170
- should 'be able to read' do
171
- signature = ESP::Signature.last
172
-
173
- assert_not_nil signature
174
-
175
- signature = ESP::Signature.find(signature.id)
176
-
177
- assert_not_nil signature
178
- end
179
- end
180
- end
181
121
  end
182
122
  end
183
123
  end
@@ -95,28 +95,6 @@ module ESP
95
95
  assert_equal ESP::CustomSignature, custom_signature.class
96
96
  end
97
97
  end
98
-
99
- context 'live calls' do
100
- setup do
101
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
102
- WebMock.allow_net_connect!
103
- end
104
-
105
- teardown do
106
- WebMock.disable_net_connect!
107
- end
108
-
109
- context '.for_stat' do
110
- should 'return tags for stat id' do
111
- report = ESP::Report.find(:first, params: { id_eq: 1 })
112
- skip "make sure you have a complete report" unless report.present?
113
- stat_id = report.stat.id
114
- stats = ESP::StatCustomSignature.for_stat(stat_id)
115
-
116
- assert_equal ESP::StatCustomSignature, stats.resource_class
117
- end
118
- end
119
- end
120
98
  end
121
99
  end
122
100
  end
@@ -29,6 +29,7 @@ module ESP
29
29
  assert_equal ESP::StatRegion, regions.resource_class
30
30
  end
31
31
  end
32
+
32
33
  context '.find' do
33
34
  should 'throw an error if stat_id is not supplied' do
34
35
  error = assert_raises ArgumentError do
@@ -94,42 +95,6 @@ module ESP
94
95
  assert_equal ESP::Region, region.class
95
96
  end
96
97
  end
97
-
98
- context 'live calls' do
99
- setup do
100
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
101
- WebMock.allow_net_connect!
102
- end
103
-
104
- teardown do
105
- WebMock.disable_net_connect!
106
- end
107
-
108
- context '#regions' do
109
- should 'return regions' do
110
- report = ESP::Report.all.detect { |r| r.status == 'complete' }
111
- skip "Live DB does not have any reports. Add a report with stats and run tests again." if report.blank?
112
- stat = ESP::Stat.for_report(report.id)
113
- regions = stat.regions
114
-
115
- region = regions.first.region
116
-
117
- assert_equal ESP::Region, region.class
118
- assert_equal regions.first.region.code, region.code
119
- end
120
- end
121
-
122
- context '.for_stat' do
123
- should 'return tags for stat id' do
124
- report = ESP::Report.find(:first, params: { id_eq: 1 })
125
- skip "make sure you have a complete report" unless report.present?
126
- stat_id = report.stat.id
127
- stats = ESP::StatRegion.for_stat(stat_id)
128
-
129
- assert_equal ESP::StatRegion, stats.resource_class
130
- end
131
- end
132
- end
133
98
  end
134
99
  end
135
100
  end
@@ -29,6 +29,7 @@ module ESP
29
29
  assert_equal ESP::StatService, services.resource_class
30
30
  end
31
31
  end
32
+
32
33
  context '.find' do
33
34
  should 'throw an error if stat_id is not supplied' do
34
35
  error = assert_raises ArgumentError do
@@ -94,42 +95,6 @@ module ESP
94
95
  assert_equal ESP::Service, service.class
95
96
  end
96
97
  end
97
-
98
- context 'live calls' do
99
- setup do
100
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
101
- WebMock.allow_net_connect!
102
- end
103
-
104
- teardown do
105
- WebMock.disable_net_connect!
106
- end
107
-
108
- context '#services' do
109
- should 'return signatures' do
110
- report = ESP::Report.all.detect { |r| r.status == 'complete' }
111
- skip "Live DB does not have any reports. Add a report with stats and run tests again." if report.blank?
112
- stat = ESP::Stat.for_report(report.id)
113
- services = stat.services
114
-
115
- service = services.first.service
116
-
117
- assert_equal ESP::Service, service.class
118
- assert_equal services.first.service.name, service.name
119
- end
120
- end
121
-
122
- context '.for_stat' do
123
- should 'return tags for stat id' do
124
- report = ESP::Report.find(:first, params: { id_eq: 1 })
125
- skip "make sure you have a complete report" unless report.present?
126
- stat_id = report.stat.id
127
- stats = ESP::StatService.for_stat(stat_id)
128
-
129
- assert_equal ESP::StatService, stats.resource_class
130
- end
131
- end
132
- end
133
98
  end
134
99
  end
135
100
  end
@@ -95,42 +95,6 @@ module ESP
95
95
  assert_equal ESP::Signature, signature.class
96
96
  end
97
97
  end
98
-
99
- context 'live calls' do
100
- setup do
101
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
102
- WebMock.allow_net_connect!
103
- end
104
-
105
- teardown do
106
- WebMock.disable_net_connect!
107
- end
108
-
109
- context '#signatures' do
110
- should 'return signatures' do
111
- report = ESP::Report.all.detect { |r| r.status == 'complete' }
112
- skip "Live DB does not have any reports. Add a report with stats and run tests again." if report.blank?
113
- stat = ESP::Stat.for_report(report.id)
114
- signatures = stat.signatures
115
-
116
- signature = signatures.first.signature
117
-
118
- assert_equal ESP::Signature, signature.class
119
- assert_equal signatures.first.signature.name, signature.name
120
- end
121
- end
122
-
123
- context '.for_stat' do
124
- should 'return tags for stat id' do
125
- report = ESP::Report.find(:first, params: { id_eq: 1 })
126
- skip "make sure you have a complete report" unless report.present?
127
- stat_id = report.stat.id
128
- stats = ESP::StatSignature.for_stat(stat_id)
129
-
130
- assert_equal ESP::StatSignature, stats.resource_class
131
- end
132
- end
133
- end
134
98
  end
135
99
  end
136
100
  end
@@ -130,74 +130,6 @@ module ESP
130
130
  assert_equal ESP::Stat, stats.resource_class
131
131
  end
132
132
  end
133
-
134
- context 'live calls' do
135
- setup do
136
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
137
- WebMock.allow_net_connect!
138
- @report = ESP::Report.all.detect { |r| r.status == 'complete' }
139
- skip "Live DB does not have any reports. Add a report with stats and run tests again." if @report.blank?
140
- @stat = ESP::Stat.for_report(@report.id)
141
- end
142
-
143
- teardown do
144
- WebMock.disable_net_connect!
145
- end
146
-
147
- context '#report' do
148
- should 'return a report' do
149
- report = @stat.report
150
-
151
- assert_equal @stat.report_id, report.id
152
- end
153
- end
154
-
155
- context '#regions' do
156
- should 'return regions' do
157
- regions = @stat.regions
158
-
159
- assert_equal ESP::StatRegion, regions.resource_class
160
- end
161
- end
162
-
163
- context '#services' do
164
- should 'return services' do
165
- services = @stat.services
166
-
167
- assert_equal ESP::StatService, services.resource_class
168
- end
169
- end
170
-
171
- context '#signatures' do
172
- should 'return signatures' do
173
- signatures = @stat.signatures
174
-
175
- assert_equal ESP::StatSignature, signatures.resource_class
176
- end
177
- end
178
-
179
- context '#custom_signautures' do
180
- should 'return custom_signautures' do
181
- custom_signatures = @stat.custom_signatures
182
-
183
- assert_equal ESP::StatCustomSignature, custom_signatures.resource_class
184
- end
185
- end
186
-
187
- context 'for_report' do
188
- should 'return the stat for the report' do
189
- assert_equal @report.id, @stat.report_id
190
- end
191
- end
192
-
193
- context '.latest_for_teams' do
194
- should 'return a collection of stats' do
195
- stats = ESP::Stat.latest_for_teams
196
-
197
- assert_equal ESP::Stat, stats.resource_class
198
- end
199
- end
200
- end
201
133
  end
202
134
  end
203
135
  end
@@ -52,84 +52,6 @@ module ESP
52
52
  end
53
53
  end
54
54
  end
55
-
56
- context 'live calls' do
57
- setup do
58
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
59
- WebMock.allow_net_connect!
60
- @sub_organization = ESP::SubOrganization.last
61
- skip "Live DB does not have any sub organizations. Add a sub organization and run tests again." if @sub_organization.blank?
62
- end
63
-
64
- teardown do
65
- WebMock.disable_net_connect!
66
- end
67
-
68
- context '#organization' do
69
- should 'return an organization' do
70
- org = @sub_organization.organization
71
-
72
- assert_equal @sub_organization.organization_id, org.id
73
- end
74
- end
75
-
76
- context '#teams' do
77
- should 'return a sub_organization' do
78
- teams = @sub_organization.teams
79
-
80
- assert_equal ESP::Team, teams.resource_class
81
- end
82
- end
83
-
84
- context '#external_accounts' do
85
- should 'return an array of external_accounts' do
86
- external_accounts = @sub_organization.external_accounts
87
-
88
- assert_equal ESP::ExternalAccount, external_accounts.resource_class
89
- end
90
- end
91
-
92
- context '#reports' do
93
- should 'return an array of reports' do
94
- reports = @sub_organization.reports
95
-
96
- assert_equal ESP::Report, reports.resource_class
97
- end
98
- end
99
-
100
- context '.where' do
101
- should 'return sub_organization objects' do
102
- sub_organizations = ESP::SubOrganization.where(id_eq: @sub_organization.id)
103
-
104
- assert_equal ESP::SubOrganization, sub_organizations.resource_class
105
- end
106
- end
107
-
108
- context '#CRUD' do
109
- should 'be able to create, update and destroy' do
110
- sub_organization = ESP::SubOrganization.new(name: 'bob', organization_id: @sub_organization.organization_id)
111
-
112
- assert_predicate sub_organization, :new?
113
-
114
- sub_organization.save
115
-
116
- refute_predicate sub_organization, :new?
117
-
118
- sub_organization.name = 'jim'
119
- sub_organization.save
120
-
121
- assert_nothing_raised do
122
- ESP::SubOrganization.find(sub_organization.id)
123
- end
124
-
125
- sub_organization.destroy
126
-
127
- assert_raises ActiveResource::ResourceNotFound do
128
- ESP::SubOrganization.find(sub_organization.id)
129
- end
130
- end
131
- end
132
- end
133
55
  end
134
56
  end
135
57
  end
@@ -67,56 +67,6 @@ module ESP
67
67
  end
68
68
  end
69
69
  end
70
-
71
- context 'live calls' do
72
- setup do
73
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
74
- WebMock.allow_net_connect!
75
- end
76
-
77
- teardown do
78
- WebMock.disable_net_connect!
79
- end
80
-
81
- context '.create' do
82
- should 'return error when reason is not supplied' do
83
- signature_id = ESP::Signature.last.id
84
- external_account_id = ESP::ExternalAccount.last.id
85
-
86
- suppression = ESP::Suppression::Region.create(signature_ids: [signature_id], custom_signature_ids: [], regions: ['us_east_1'], external_account_ids: [external_account_id])
87
-
88
- assert_equal "Reason can't be blank", suppression.errors.full_messages.first
89
- end
90
-
91
- should 'return suppression' do
92
- signature_id = ESP::Signature.last.id
93
- external_account_id = ESP::ExternalAccount.last.id
94
-
95
- suppression = ESP::Suppression::Region.create(signature_ids: [signature_id], custom_signature_ids: [], reason: 'test', regions: ['us_east_1'], external_account_ids: [external_account_id])
96
-
97
- assert_equal ESP::Suppression::Region, suppression.class
98
- end
99
-
100
- context 'for_alert' do
101
- should 'return error when reason is not supplied' do
102
- alert_id = ESP::Report.all.detect { |r| r.status == 'complete' }.alerts.last.id
103
-
104
- suppression = ESP::Suppression::Region.create(alert_id: alert_id)
105
-
106
- assert_equal "Reason can't be blank", suppression.errors.full_messages.first
107
- end
108
-
109
- should 'return suppression' do
110
- alert_id = ESP::Report.all.detect { |r| r.status == 'complete' }.alerts.last.id
111
-
112
- suppression = ESP::Suppression::Region.create(alert_id: alert_id, reason: 'test')
113
-
114
- assert_predicate suppression.errors, :blank?
115
- assert_equal ESP::Suppression::Region, suppression.class
116
- end
117
- end
118
- end
119
- end
120
70
  end
121
71
  end
122
72
  end
@@ -69,56 +69,6 @@ module ESP
69
69
  end
70
70
  end
71
71
  end
72
-
73
- context 'live calls' do
74
- setup do
75
- skip "Make sure you run the live calls locally to ensure proper integration" if ENV['CI_SERVER']
76
- WebMock.allow_net_connect!
77
- end
78
-
79
- teardown do
80
- WebMock.disable_net_connect!
81
- end
82
-
83
- context '.create' do
84
- should 'return error when reason is not supplied' do
85
- signature_id = ESP::Signature.last.id
86
- external_account_id = ESP::ExternalAccount.last.id
87
-
88
- suppression = ESP::Suppression::Signature.create(signature_ids: [signature_id], custom_signature_ids: [], regions: ['us_east_1'], external_account_ids: [external_account_id])
89
-
90
- assert_equal "Reason can't be blank", suppression.errors.full_messages.first
91
- end
92
-
93
- should 'return suppression' do
94
- signature_id = ESP::Signature.last.id
95
- external_account_id = ESP::ExternalAccount.last.id
96
-
97
- suppression = ESP::Suppression::Signature.create(signature_ids: [signature_id], custom_signature_ids: [], reason: 'test', regions: ['us_east_1'], external_account_ids: [external_account_id])
98
-
99
- assert_equal ESP::Suppression::Signature, suppression.class
100
- end
101
-
102
- context 'for_alert' do
103
- should 'return error when reason is not supplied' do
104
- alert_id = ESP::Report.all.detect { |r| r.status == 'complete' }.alerts.last.id
105
-
106
- suppression = ESP::Suppression::Signature.create(alert_id: alert_id)
107
-
108
- assert_equal "Reason can't be blank", suppression.errors.full_messages.first
109
- end
110
-
111
- should 'return suppression' do
112
- alert_id = ESP::Report.all.detect { |r| r.status == 'complete' }.alerts.last.id
113
-
114
- suppression = ESP::Suppression::Signature.create(alert_id: alert_id, reason: 'test')
115
-
116
- assert_predicate suppression.errors, :blank?
117
- assert_equal ESP::Suppression::Signature, suppression.class
118
- end
119
- end
120
- end
121
- end
122
72
  end
123
73
  end
124
74
  end