| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package main |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/stretchr/testify/require" |
| 9 | ) |
| 10 | |
| 11 | func TestSourceDisplayNameRedactsURL(t *testing.T) { |
| 12 | name := sourceDisplayName(sourceEntry{ |
| 13 | family: sourceFamilyGeo, |
| 14 | provider: providerDBIP, |
| 15 | artifact: artifactDBIPCityLite, |
| 16 | format: formatMMDB, |
| 17 | url: "https://user:secret@example.test/download/city.mmdb.gz?token=abc#frag", |
| 18 | }) |
| 19 | |
| 20 | require.Equal(t, "dbip:city-lite@mmdb url=https://example.test/<redacted>", name) |
| 21 | } |