MCPcopy
hub / github.com/netbirdio/netbird / TestAnonymizString_MemorizedDomain

Function TestAnonymizString_MemorizedDomain

client/anonymize/anonymize_test.go:230–244  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

228}
229
230func TestAnonymizString_MemorizedDomain(t *testing.T) {
231 anonymizer := anonymize.NewAnonymizer(netip.Addr{}, netip.Addr{})
232 domain := "example.com"
233 anonymizedDomain := anonymizer.AnonymizeDomain(domain)
234
235 sampleString := "This is a test string including the domain example.com which should be anonymized."
236
237 firstPassResult := anonymizer.AnonymizeString(sampleString)
238 secondPassResult := anonymizer.AnonymizeString(firstPassResult)
239
240 assert.Contains(t, firstPassResult, anonymizedDomain, "The domain should be anonymized in the first pass")
241 assert.NotContains(t, firstPassResult, domain, "The original domain should not appear in the first pass output")
242
243 assert.Equal(t, firstPassResult, secondPassResult, "The second pass should not further anonymize the string")
244}
245
246func TestAnonymizeString_DoubleURI(t *testing.T) {
247 anonymizer := anonymize.NewAnonymizer(netip.Addr{}, netip.Addr{})

Callers

nothing calls this directly

Calls 4

AnonymizeDomainMethod · 0.95
AnonymizeStringMethod · 0.95
NewAnonymizerFunction · 0.92
EqualMethod · 0.65

Tested by

no test coverage detected