mirror of
https://github.com/we-promise/sure.git
synced 2026-12-03 20:32:40 +08:00
Count the debug log entries on a refused Brex token
The transactions 403 path was tested for the sync outcome only, so a capture moved above the credentials re-raise in fetch_and_store_transactions went unnoticed and logged the failure twice. The syncer test now expects exactly one entry, from BrexItem::Syncer. Siblings: the accounts 401 path is already pinned by 'a credential failure is logged once' in importer_test.rb; unchanged.
This commit is contained in:
@@ -167,11 +167,14 @@ class BrexItem::SyncerTest < ActiveSupport::TestCase
|
||||
.raises(Provider::Brex::BrexError.new("Access forbidden", :access_forbidden, http_status: 403))
|
||||
sync = Sync.create!(syncable: @brex_item)
|
||||
|
||||
sync.perform
|
||||
assert_difference -> { DebugLogEntry.count }, 1 do
|
||||
sync.perform
|
||||
end
|
||||
|
||||
assert sync.reload.failed?, "expected the sync to fail, was #{sync.status}"
|
||||
assert_equal I18n.t("brex_items.syncer.credentials_invalid"), sync.error
|
||||
assert @brex_item.reload.requires_update?
|
||||
assert_equal "BrexItem::Syncer", DebugLogEntry.where(provider_key: "brex").recent.first.source
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user