test: DeviceIdentification circuit breaker fetch path

This commit is contained in:
Graham McIntire 2026-04-24 08:41:01 -05:00
parent a039ff2561
commit c9ce044830
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -203,6 +203,17 @@ defmodule Aprsme.DeviceIdentificationTest do
end
end
describe "fetch_and_upsert_devices circuit-breaker path" do
test "returns an error tuple when circuit breaker rejects or HTTP fails" do
# This just exercises the fetch_and_upsert_devices path, which runs via
# Aprsme.CircuitBreaker.call/3. Without an HTTP stub, this will get an
# error back from either the breaker or the underlying Req call.
result = DeviceIdentification.fetch_and_upsert_devices()
assert match?({:error, _}, result) or result == :ok
end
end
describe "lookup_device_from_db fallback when cache is unavailable" do
test "lookup_device_by_identifier falls back to direct DB when DeviceCache is unavailable" do
Repo.delete_all(Devices)