diff --git a/lib/mihari/actor.rb b/lib/mihari/actor.rb index 833bafb90..3a2f402f0 100644 --- a/lib/mihari/actor.rb +++ b/lib/mihari/actor.rb @@ -63,7 +63,7 @@ def call(*args, **kwargs) raise NotImplementedError, "You must implement #{self.class}##{__method__}" end - def result(...) + def get_result(...) Try[StandardError] do retry_on_error(times: retry_times, interval: retry_interval, exponential_backoff: retry_exponential_backoff) do call(...) diff --git a/lib/mihari/analyzers/base.rb b/lib/mihari/analyzers/base.rb index c2900cfeb..7d2edc1b0 100644 --- a/lib/mihari/analyzers/base.rb +++ b/lib/mihari/analyzers/base.rb @@ -77,7 +77,7 @@ def call normalized_artifacts end - def result(...) + def get_result(...) result = Try[StandardError] do retry_on_error( times: retry_times, diff --git a/lib/mihari/commands/alert.rb b/lib/mihari/commands/alert.rb index 6f582d23d..49756066a 100644 --- a/lib/mihari/commands/alert.rb +++ b/lib/mihari/commands/alert.rb @@ -91,7 +91,7 @@ def list_transform(q = "") # @param [Integer] id # def get(id) - value = Services::AlertGetter.result(id).value! + value = Services::AlertGetter.get_result(id).value! data = Entities::Alert.represent(value) puts JSON.pretty_generate(data.as_json) end diff --git a/lib/mihari/commands/artifact.rb b/lib/mihari/commands/artifact.rb index e2e9b2273..a8fadeb79 100644 --- a/lib/mihari/commands/artifact.rb +++ b/lib/mihari/commands/artifact.rb @@ -71,7 +71,7 @@ def list_transform(q = "") # @param [Integer] id # def get(id) - value = Services::ArtifactGetter.result(id).value! + value = Services::ArtifactGetter.get_result(id).value! data = Entities::Artifact.represent(value) puts JSON.pretty_generate(data.as_json) end diff --git a/lib/mihari/commands/rule.rb b/lib/mihari/commands/rule.rb index 73c475d50..f8d1f1b86 100644 --- a/lib/mihari/commands/rule.rb +++ b/lib/mihari/commands/rule.rb @@ -116,7 +116,7 @@ def list_transform(q = "") desc "get ID", "Get a rule" around :with_db_connection def get(id) - value = Services::RuleGetter.result(id).value! + value = Services::RuleGetter.get_result(id).value! data = Entities::Rule.represent(value) puts JSON.pretty_generate(data.as_json) end diff --git a/lib/mihari/emitters/base.rb b/lib/mihari/emitters/base.rb index a1438cbf8..408f4ba61 100644 --- a/lib/mihari/emitters/base.rb +++ b/lib/mihari/emitters/base.rb @@ -44,7 +44,7 @@ def call(artifacts) # # @return [Dry::Monads::Result::Success, Dry::Monads::Result::Failure] # - def result(artifacts) + def get_result(artifacts) result = Try[StandardError] do retry_on_error( times: retry_times, diff --git a/lib/mihari/enrichers/base.rb b/lib/mihari/enrichers/base.rb index 8d284d868..8af468ae8 100644 --- a/lib/mihari/enrichers/base.rb +++ b/lib/mihari/enrichers/base.rb @@ -29,7 +29,7 @@ def call(artifact) # # @return [Dry::Monads::Result::Success, Dry::Monads::Result::Failure] # - def result(artifact) + def get_result(artifact) return unless callable?(artifact) result = Try[StandardError] do diff --git a/lib/mihari/models/artifact.rb b/lib/mihari/models/artifact.rb index c3989756b..50b768698 100644 --- a/lib/mihari/models/artifact.rb +++ b/lib/mihari/models/artifact.rb @@ -191,7 +191,7 @@ def enrich_by_enrichers(enrichers) # NOTE: doing parallel with ActiveRecord objects is troublesome (e.g. connection issue, etc.) # so converting the object to an OpenStruct object s = struct - results = Parallel.map(enrichers) { |enricher| enricher.result s } + results = Parallel.map(enrichers) { |enricher| enricher.get_result s } enriched = results.compact.map { |result| result.value_or(nil) }.compact self.dns_records = enriched.map(&:dns_records).flatten.compact diff --git a/lib/mihari/models/port.rb b/lib/mihari/models/port.rb index 96cf8256a..a065b84d0 100644 --- a/lib/mihari/models/port.rb +++ b/lib/mihari/models/port.rb @@ -18,7 +18,7 @@ class << self # @return [Array] # def build_by_ip(ip, enricher: Enrichers::Shodan.new) - enricher.result(ip).fmap do |res| + enricher.get_result(ip).fmap do |res| (res&.ports || []).map { |port| new(port:) } end.value_or [] end diff --git a/lib/mihari/rule.rb b/lib/mihari/rule.rb index 647c77104..4062dbc30 100644 --- a/lib/mihari/rule.rb +++ b/lib/mihari/rule.rb @@ -191,8 +191,8 @@ def bulk_emit return [] if enriched_artifacts.empty? [].tap do |out| - out << serial_emitters.map { |emitter| emitter.result(enriched_artifacts).value_or(nil) } - out << Parallel.map(parallel_emitters) { |emitter| emitter.result(enriched_artifacts).value_or(nil) } + out << serial_emitters.map { |emitter| emitter.get_result(enriched_artifacts).value_or(nil) } + out << Parallel.map(parallel_emitters) { |emitter| emitter.get_result(enriched_artifacts).value_or(nil) } end.flatten.compact end @@ -349,8 +349,8 @@ def serial_analyzers # @return [Array>, Dry::Monads::Result::Failure>] def analyzer_results [].tap do |out| - out << Parallel.map(parallel_analyzers, &:result) - out << serial_analyzers.map(&:result) + out << Parallel.map(parallel_analyzers, &:get_result) + out << serial_analyzers.map(&:get_result) end.flatten end diff --git a/lib/mihari/service.rb b/lib/mihari/service.rb index 385c8e7c3..39cf39fc0 100644 --- a/lib/mihari/service.rb +++ b/lib/mihari/service.rb @@ -11,7 +11,7 @@ def call(*args, **kwargs) raise NotImplementedError, "You must implement #{self.class}##{__method__}" end - def result(...) + def get_result(...) Try[StandardError] { call(...) }.to_result end @@ -20,8 +20,8 @@ def call(...) new.call(...) end - def result(...) - new.result(...) + def get_result(...) + new.get_result(...) end end end diff --git a/lib/mihari/web/endpoints/alerts.rb b/lib/mihari/web/endpoints/alerts.rb index 1680726f2..1750780f3 100644 --- a/lib/mihari/web/endpoints/alerts.rb +++ b/lib/mihari/web/endpoints/alerts.rb @@ -41,7 +41,7 @@ class Alerts < Grape::API end get "/:id" do id = params[:id].to_i - result = Services::AlertGetter.result(id) + result = Services::AlertGetter.get_result(id) return present(result.value!, with: Entities::Alert) if result.success? case result.failure @@ -61,7 +61,7 @@ class Alerts < Grape::API end delete "/:id" do id = params["id"].to_i - result = Services::AlertDestroyer.result(id) + result = Services::AlertDestroyer.get_result(id) return if result.success? case result.failure @@ -86,7 +86,7 @@ class Alerts < Grape::API post "/" do status 201 - result = Services::AlertCreator.result(params) + result = Services::AlertCreator.get_result(params) return present(result.value!, with: Entities::Alert) if result.success? case result.failure diff --git a/lib/mihari/web/endpoints/artifacts.rb b/lib/mihari/web/endpoints/artifacts.rb index ba28d8203..3980736d5 100644 --- a/lib/mihari/web/endpoints/artifacts.rb +++ b/lib/mihari/web/endpoints/artifacts.rb @@ -41,7 +41,7 @@ class Artifacts < Grape::API end get "/:id" do id = params[:id].to_i - result = Services::ArtifactGetter.result(id) + result = Services::ArtifactGetter.get_result(id) return present(result.value!, with: Entities::Artifact) if result.success? case result.failure @@ -98,7 +98,7 @@ class Artifacts < Grape::API status 204 id = params["id"].to_i - result = Services::ArtifactDestroyer.result(id) + result = Services::ArtifactDestroyer.get_result(id) return if result.success? case result.failure diff --git a/lib/mihari/web/endpoints/ip_addresses.rb b/lib/mihari/web/endpoints/ip_addresses.rb index d654a823d..91ac1723c 100644 --- a/lib/mihari/web/endpoints/ip_addresses.rb +++ b/lib/mihari/web/endpoints/ip_addresses.rb @@ -21,7 +21,7 @@ class IPAddresses < Grape::API end get "/:ip", requirements: {ip: %r{[^/]+}} do ip = params[:ip].to_s - result = Services::IPGetter.result(ip) + result = Services::IPGetter.get_result(ip) if result.success? value = result.value! return present( diff --git a/lib/mihari/web/endpoints/rules.rb b/lib/mihari/web/endpoints/rules.rb index ef6cc2b35..887156705 100644 --- a/lib/mihari/web/endpoints/rules.rb +++ b/lib/mihari/web/endpoints/rules.rb @@ -59,7 +59,7 @@ def call(yaml, overwrite: true) end get "/:id" do id = params[:id].to_s - result = Services::RuleGetter.result(params[:id].to_s) + result = Services::RuleGetter.get_result(params[:id].to_s) return present(result.value!, with: Entities::Rule) if result.success? case result.failure @@ -120,7 +120,7 @@ def call(yaml, overwrite: true) yaml = params[:yaml].to_s - result = RuleCreateUpdater.result(yaml, overwrite: false) + result = RuleCreateUpdater.get_result(yaml, overwrite: false) return present(result.value!.model, with: Entities::Rule) if result.success? failure = result.failure @@ -151,7 +151,7 @@ def call(yaml, overwrite: true) yaml = params[:yaml].to_s - result = RuleCreateUpdater.result(yaml, overwrite: true) + result = RuleCreateUpdater.get_result(yaml, overwrite: true) return present(result.value!.model, with: Entities::Rule) if result.success? failure = result.failure @@ -178,7 +178,7 @@ def call(yaml, overwrite: true) status 204 id = params[:id].to_s - result = Services::RuleDestroyer.result(id) + result = Services::RuleDestroyer.get_result(id) return if result.success? case result.failure diff --git a/lib/mihari/web/endpoints/tags.rb b/lib/mihari/web/endpoints/tags.rb index bf8e96bfb..3faa6b8f7 100644 --- a/lib/mihari/web/endpoints/tags.rb +++ b/lib/mihari/web/endpoints/tags.rb @@ -43,7 +43,7 @@ class Tags < Grape::API status 204 id = params[:id].to_i - result = Services::TagDestroyer.result(id) + result = Services::TagDestroyer.get_result(id) return if result.success? case result.failure diff --git a/spec/actor_spec.rb b/spec/actor_spec.rb index d0efb97e8..fc68af205 100644 --- a/spec/actor_spec.rb +++ b/spec/actor_spec.rb @@ -17,7 +17,7 @@ def call describe "#result" do it do - expect(actor.result.failure).to be_a(ZeroDivisionError) + expect(actor.get_result.failure).to be_a(ZeroDivisionError) end end end diff --git a/spec/fixtures/vcr_cassettes/Mihari_Enrichers_MMDB/_call/1_1_1.yml b/spec/fixtures/vcr_cassettes/Mihari_Enrichers_MMDB/_call/1_1_1.yml index b97c5486b..9ab6b8b7d 100644 --- a/spec/fixtures/vcr_cassettes/Mihari_Enrichers_MMDB/_call/1_1_1.yml +++ b/spec/fixtures/vcr_cassettes/Mihari_Enrichers_MMDB/_call/1_1_1.yml @@ -7,19 +7,19 @@ http_interactions: encoding: ASCII-8BIT string: '' headers: + User-Agent: + - mihari/8.0.0 Connection: - close Host: - ip.circl.lu - User-Agent: - - http.rb/5.1.1 response: status: code: 200 message: OK headers: Date: - - Thu, 28 Dec 2023 11:06:56 GMT + - Sat, 30 Nov 2024 01:04:14 GMT Server: - WSGIServer/0.2 CPython/3.8.10 Strict-Transport-Security: @@ -44,5 +44,5 @@ http_interactions: 1316075}, "ip": "1.1.1.1", "country_info": {"Country": "United States", "Alpha-2 code": "US", "Alpha-3 code": "USA", "Numeric code": "840", "Latitude (average)": "38", "Longitude (average)": "-97"}}]' - recorded_at: Thu, 28 Dec 2023 11:06:56 GMT -recorded_with: VCR 6.2.0 + recorded_at: Sat, 30 Nov 2024 01:04:14 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/Mihari_Enrichers_MMDB/ip_1_1_1_1.yml b/spec/fixtures/vcr_cassettes/Mihari_Enrichers_MMDB/ip_1_1_1_1.yml index 3d66af1df..fc943f437 100644 --- a/spec/fixtures/vcr_cassettes/Mihari_Enrichers_MMDB/ip_1_1_1_1.yml +++ b/spec/fixtures/vcr_cassettes/Mihari_Enrichers_MMDB/ip_1_1_1_1.yml @@ -7,19 +7,19 @@ http_interactions: encoding: ASCII-8BIT string: '' headers: + User-Agent: + - mihari/8.0.0 Connection: - close Host: - ip.circl.lu - User-Agent: - - http.rb/5.1.1 response: status: code: 200 message: OK headers: Date: - - Thu, 28 Dec 2023 11:08:58 GMT + - Sat, 30 Nov 2024 01:04:16 GMT Server: - WSGIServer/0.2 CPython/3.8.10 Strict-Transport-Security: @@ -44,5 +44,5 @@ http_interactions: 1316075}, "ip": "1.1.1.1", "country_info": {"Country": "United States", "Alpha-2 code": "US", "Alpha-3 code": "USA", "Numeric code": "840", "Latitude (average)": "38", "Longitude (average)": "-97"}}]' - recorded_at: Thu, 28 Dec 2023 11:08:58 GMT -recorded_with: VCR 6.2.0 + recorded_at: Sat, 30 Nov 2024 01:04:16 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/fixtures/vcr_cassettes/Mihari_Web_Endpoints_Artifacts/get_/api/artifacts/_id/enrich/returns_201.yml b/spec/fixtures/vcr_cassettes/Mihari_Web_Endpoints_Artifacts/get_/api/artifacts/_id/enrich/returns_201.yml deleted file mode 100644 index 61b5003e4..000000000 --- a/spec/fixtures/vcr_cassettes/Mihari_Web_Endpoints_Artifacts/get_/api/artifacts/_id/enrich/returns_201.yml +++ /dev/null @@ -1,269 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://dns.google/resolve?name=www.example.com&type=A - body: - encoding: ASCII-8BIT - string: '' - headers: - Connection: - - close - Host: - - dns.google - User-Agent: - - http.rb/5.1.1 - response: - status: - code: 200 - message: OK - headers: - X-Content-Type-Options: - - nosniff - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Access-Control-Allow-Origin: - - "*" - Date: - - Sun, 29 Oct 2023 00:15:20 GMT - Expires: - - Sun, 29 Oct 2023 00:15:20 GMT - Cache-Control: - - private, max-age=1105 - Content-Type: - - application/json; charset=UTF-8 - Server: - - HTTP server (unknown) - X-Xss-Protection: - - '0' - X-Frame-Options: - - SAMEORIGIN - Alt-Svc: - - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 - Accept-Ranges: - - none - Vary: - - Accept-Encoding - Connection: - - close - Transfer-Encoding: - - chunked - body: - encoding: UTF-8 - string: '{"Status":0,"TC":false,"RD":true,"RA":true,"AD":true,"CD":false,"Question":[{"name":"www.example.com.","type":1}],"Answer":[{"name":"www.example.com.","type":1,"TTL":1105,"data":"93.184.216.34"}]}' - recorded_at: Sun, 29 Oct 2023 00:15:20 GMT -- request: - method: get - uri: https://dns.google/resolve?name=www.example.com&type=AAAA - body: - encoding: ASCII-8BIT - string: '' - headers: - Connection: - - close - Host: - - dns.google - User-Agent: - - http.rb/5.1.1 - response: - status: - code: 200 - message: OK - headers: - X-Content-Type-Options: - - nosniff - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Access-Control-Allow-Origin: - - "*" - Date: - - Sun, 29 Oct 2023 00:15:21 GMT - Expires: - - Sun, 29 Oct 2023 00:15:21 GMT - Cache-Control: - - private, max-age=18760 - Content-Type: - - application/json; charset=UTF-8 - Server: - - HTTP server (unknown) - X-Xss-Protection: - - '0' - X-Frame-Options: - - SAMEORIGIN - Alt-Svc: - - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 - Accept-Ranges: - - none - Vary: - - Accept-Encoding - Connection: - - close - Transfer-Encoding: - - chunked - body: - encoding: UTF-8 - string: '{"Status":0,"TC":false,"RD":true,"RA":true,"AD":true,"CD":false,"Question":[{"name":"www.example.com.","type":28}],"Answer":[{"name":"www.example.com.","type":28,"TTL":18760,"data":"2606:2800:220:1:248:1893:25c8:1946"}]}' - recorded_at: Sun, 29 Oct 2023 00:15:21 GMT -- request: - method: get - uri: https://dns.google/resolve?name=www.example.com&type=CNAME - body: - encoding: ASCII-8BIT - string: '' - headers: - Connection: - - close - Host: - - dns.google - User-Agent: - - http.rb/5.1.1 - response: - status: - code: 200 - message: OK - headers: - X-Content-Type-Options: - - nosniff - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Access-Control-Allow-Origin: - - "*" - Date: - - Sun, 29 Oct 2023 00:15:21 GMT - Expires: - - Sun, 29 Oct 2023 00:15:21 GMT - Cache-Control: - - private, max-age=1800 - Content-Type: - - application/json; charset=UTF-8 - Server: - - HTTP server (unknown) - X-Xss-Protection: - - '0' - X-Frame-Options: - - SAMEORIGIN - Alt-Svc: - - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 - Accept-Ranges: - - none - Vary: - - Accept-Encoding - Connection: - - close - Transfer-Encoding: - - chunked - body: - encoding: UTF-8 - string: '{"Status":0,"TC":false,"RD":true,"RA":true,"AD":true,"CD":false,"Question":[{"name":"www.example.com.","type":5}],"Authority":[{"name":"example.com.","type":6,"TTL":1800,"data":"ns.icann.org. - noc.dns.icann.org. 2022091354 7200 3600 1209600 3600"}],"Comment":"Response - from 2001:500:8f::53."}' - recorded_at: Sun, 29 Oct 2023 00:15:21 GMT -- request: - method: get - uri: https://dns.google/resolve?name=www.example.com&type=TXT - body: - encoding: ASCII-8BIT - string: '' - headers: - Connection: - - close - Host: - - dns.google - User-Agent: - - http.rb/5.1.1 - response: - status: - code: 200 - message: OK - headers: - X-Content-Type-Options: - - nosniff - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Access-Control-Allow-Origin: - - "*" - Date: - - Sun, 29 Oct 2023 00:15:21 GMT - Expires: - - Sun, 29 Oct 2023 00:15:21 GMT - Cache-Control: - - private, max-age=21600 - Content-Type: - - application/json; charset=UTF-8 - Server: - - HTTP server (unknown) - X-Xss-Protection: - - '0' - X-Frame-Options: - - SAMEORIGIN - Alt-Svc: - - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 - Accept-Ranges: - - none - Vary: - - Accept-Encoding - Connection: - - close - Transfer-Encoding: - - chunked - body: - encoding: UTF-8 - string: '{"Status":0,"TC":false,"RD":true,"RA":true,"AD":true,"CD":false,"Question":[{"name":"www.example.com.","type":16}],"Answer":[{"name":"www.example.com.","type":16,"TTL":21600,"data":"v=spf1 - -all"},{"name":"www.example.com.","type":16,"TTL":21600,"data":"wgyf8z8cgvm2qmxpnbnldrcltvk4xqfn"}],"Comment":"Response - from 199.43.133.53."}' - recorded_at: Sun, 29 Oct 2023 00:15:21 GMT -- request: - method: get - uri: https://dns.google/resolve?name=www.example.com&type=NS - body: - encoding: ASCII-8BIT - string: '' - headers: - Connection: - - close - Host: - - dns.google - User-Agent: - - http.rb/5.1.1 - response: - status: - code: 200 - message: OK - headers: - X-Content-Type-Options: - - nosniff - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Access-Control-Allow-Origin: - - "*" - Date: - - Sun, 29 Oct 2023 00:15:21 GMT - Expires: - - Sun, 29 Oct 2023 00:15:21 GMT - Cache-Control: - - private, max-age=1800 - Content-Type: - - application/json; charset=UTF-8 - Server: - - HTTP server (unknown) - X-Xss-Protection: - - '0' - X-Frame-Options: - - SAMEORIGIN - Alt-Svc: - - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 - Accept-Ranges: - - none - Vary: - - Accept-Encoding - Connection: - - close - Transfer-Encoding: - - chunked - body: - encoding: UTF-8 - string: '{"Status":0,"TC":false,"RD":true,"RA":true,"AD":true,"CD":false,"Question":[{"name":"www.example.com.","type":2}],"Authority":[{"name":"example.com.","type":6,"TTL":1800,"data":"ns.icann.org. - noc.dns.icann.org. 2022091354 7200 3600 1209600 3600"}],"Comment":"Response - from 199.43.133.53."}' - recorded_at: Sun, 29 Oct 2023 00:15:21 GMT -recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Mihari_Web_Endpoints_IPAddresses/get_/api/ip_addresses/_ip/returns_200.yml b/spec/fixtures/vcr_cassettes/Mihari_Web_Endpoints_IPAddresses/get_/api/ip_addresses/_ip/returns_200.yml new file mode 100644 index 000000000..98d2179c1 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Mihari_Web_Endpoints_IPAddresses/get_/api/ip_addresses/_ip/returns_200.yml @@ -0,0 +1,48 @@ +--- +http_interactions: +- request: + method: get + uri: https://ip.circl.lu/geolookup/1.1.1.1 + body: + encoding: ASCII-8BIT + string: '' + headers: + User-Agent: + - mihari/8.0.0 + Connection: + - close + Host: + - ip.circl.lu + response: + status: + code: 200 + message: OK + headers: + Date: + - Sat, 30 Nov 2024 01:07:41 GMT + Server: + - WSGIServer/0.2 CPython/3.8.10 + Strict-Transport-Security: + - max-age=15768000 + Content-Type: + - application/json + Content-Length: + - '906' + Connection: + - close + body: + encoding: UTF-8 + string: '[{"country": {"iso_code": "US"}, "meta": {"description": {"en": "Geo + Open MMDB database - https://github.com/adulau/mmdb-server"}, "build_db": + "2023-11-20 12:50:37", "db_source": "GeoOpen-Country", "nb_nodes": 1315572}, + "ip": "1.1.1.1", "country_info": {"Country": "United States", "Alpha-2 code": + "US", "Alpha-3 code": "USA", "Numeric code": "840", "Latitude (average)": + "38", "Longitude (average)": "-97"}}, {"country": {"iso_code": "US", "AutonomousSystemNumber": + "13335", "AutonomousSystemOrganization": "CLOUDFLARENET"}, "meta": {"description": + {"en": "Geo Open MMDB database - https://github.com/adulau/mmdb-server"}, + "build_db": "2023-11-20 15:49:14", "db_source": "GeoOpen-Country-ASN", "nb_nodes": + 1316075}, "ip": "1.1.1.1", "country_info": {"Country": "United States", "Alpha-2 + code": "US", "Alpha-3 code": "USA", "Numeric code": "840", "Latitude (average)": + "38", "Longitude (average)": "-97"}}]' + recorded_at: Sat, 30 Nov 2024 01:07:42 GMT +recorded_with: VCR 6.3.1 diff --git a/spec/web/endpoints/ip_addresses_spec.rb b/spec/web/endpoints/ip_addresses_spec.rb index 2749db756..14abb399a 100644 --- a/spec/web/endpoints/ip_addresses_spec.rb +++ b/spec/web/endpoints/ip_addresses_spec.rb @@ -2,7 +2,7 @@ require "json" -RSpec.describe Mihari::Web::Endpoints::IPAddresses, vcr: "Mihari_Enrichers_MMDB/ip:1.1.1.1" do +RSpec.describe Mihari::Web::Endpoints::IPAddresses, :vcr do include Rack::Test::Methods def app @@ -28,9 +28,9 @@ def app ) end - it "returns 404" do + it "returns 422" do get "/api/ip_addresses/404" - expect(last_response.status).to eq(404) + expect(last_response.status).to eq(422) end end end