From a7941bb92df67686b018fbb601cbf413ea909d14 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 25 Aug 2026 15:58:38 +0200 Subject: privacy: use Krakow in examples, tests and fixtures A recorded GUGiK fixture was a reverse address lookup for the author's home: it carried a house number, a postal code and coordinates to about a metre, and it was published. The place name in the README was the lesser half of the problem. Fixtures are re-recorded against Rynek Glowny in Krakow, a public square, and the tests, spec example and README follow. The README example is regenerated from the binary. warnings.json is left as recorded: it is a verbatim national bulletin whose teryt array lists roughly two hundred powiats, so no single entry says anything about anyone. NOTE: this removes the address from the tip, not from history. Commit e14a7db and its successors still contain it, and remain reachable on any clone or mirror. --- internal/cache/cache_test.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'internal/cache') diff --git a/internal/cache/cache_test.go b/internal/cache/cache_test.go index 3283db2..9560ff2 100644 --- a/internal/cache/cache_test.go +++ b/internal/cache/cache_test.go @@ -126,7 +126,7 @@ func TestGeoIsStoredAsAnArrayForPythonInterop(t *testing.T) { // A cache written in the Python shape must load here unchanged. func TestReadsPythonWrittenCache(t *testing.T) { path := filepath.Join(t.TempDir(), "cache.json") - body := `{"geo":{"Krakow":[50.06170,19.93730,"Krakow, PL","PL"]},"teryt":{"50.0617,19.9373":"1815"}}` + body := `{"geo":{"Krakow":[50.06174,19.93732,"Krakow, PL","PL"]},"teryt":{"50.0617,19.9373":"1261"}}` if err := os.WriteFile(path, []byte(body), 0o644); err != nil { t.Fatal(err) } @@ -135,7 +135,7 @@ func TestReadsPythonWrittenCache(t *testing.T) { if !ok || g.Label != "Krakow, PL" || g.Country != "PL" { t.Fatalf("got %+v (%v)", g, ok) } - if code, ok := c.Teryt("50.0617,19.9373"); !ok || code != "1815" { + if code, ok := c.Teryt("50.0617,19.9373"); !ok || code != "1261" { t.Fatalf("teryt = %q (%v)", code, ok) } } @@ -156,7 +156,7 @@ func writeCache(t *testing.T, c *Cache, body string) { // everything that was still fine. func TestOneMalformedEntryDoesNotDestroyTheOthers(t *testing.T) { c := tmpCache(t) - writeCache(t, c, `{"geo":{"Gdansk":[54.35227,18.64912,"Gdansk, PL","PL"],"Broken":[1]},"teryt":{"50.0617,19.9373":"1815"}}`) + writeCache(t, c, `{"geo":{"Gdansk":[54.35227,18.64912,"Gdansk, PL","PL"],"Broken":[1]},"teryt":{"50.0617,19.9373":"1261"}}`) if err := c.PutGeo("Krakow", Geo{Lat: 50.0617, Lon: 19.9373, Label: "Krakow, PL", Country: "PL"}); err != nil { t.Fatal(err) @@ -167,7 +167,7 @@ func TestOneMalformedEntryDoesNotDestroyTheOthers(t *testing.T) { if _, ok := c.Geo("Krakow"); !ok { t.Error("the new entry was not stored") } - if code, ok := c.Teryt("50.0617,19.9373"); !ok || code != "1815" { + if code, ok := c.Teryt("50.0617,19.9373"); !ok || code != "1261" { t.Errorf("teryt section lost too: got %q, %v", code, ok) } if _, ok := c.Geo("Broken"); ok { @@ -202,14 +202,14 @@ func TestPutTerytAlsoMovesAnUnparseableFileAside(t *testing.T) { c := tmpCache(t) const broken = `{oops` writeCache(t, c, broken) - if err := c.PutTeryt("50.0617,19.9373", "1815"); err != nil { + if err := c.PutTeryt("50.0617,19.9373", "1261"); err != nil { t.Fatalf("the tool must keep working: %v", err) } kept, err := os.ReadFile(c.path + ".bad") if err != nil || string(kept) != broken { t.Errorf("unparseable file not preserved: %q, %v", kept, err) } - if code, ok := c.Teryt("50.0617,19.9373"); !ok || code != "1815" { + if code, ok := c.Teryt("50.0617,19.9373"); !ok || code != "1261" { t.Errorf("fresh cache did not take the entry: %q, %v", code, ok) } } @@ -217,13 +217,13 @@ func TestPutTerytAlsoMovesAnUnparseableFileAside(t *testing.T) { // The file is read by a human at least as often as by the program. func TestSaveWritesOneEntryPerLine(t *testing.T) { c := tmpCache(t) - if err := c.PutGeo("Krakow", Geo{Lat: 50.06170, Lon: 19.93730, Label: "Krakow, PL", Country: "PL"}); err != nil { + if err := c.PutGeo("Krakow", Geo{Lat: 50.06174, Lon: 19.93732, Label: "Krakow, PL", Country: "PL"}); err != nil { t.Fatal(err) } if err := c.PutGeo("Chiang Mai", Geo{Lat: 18.79038, Lon: 98.98468, Label: "Chiang Mai, TH", Country: "TH"}); err != nil { t.Fatal(err) } - if err := c.PutTeryt("50.0617,19.9373", "1815"); err != nil { + if err := c.PutTeryt("50.0617,19.9373", "1261"); err != nil { t.Fatal(err) } body, err := os.ReadFile(c.path) @@ -233,10 +233,10 @@ func TestSaveWritesOneEntryPerLine(t *testing.T) { want := `{ "geo": { "Chiang Mai": [18.79038, 98.98468, "Chiang Mai, TH", "TH"], - "Krakow": [50.06170, 19.93730, "Krakow, PL", "PL"] + "Krakow": [50.06174, 19.93732, "Krakow, PL", "PL"] }, "teryt": { - "50.0617,19.9373": "1815" + "50.0617,19.9373": "1261" } } ` @@ -247,7 +247,7 @@ func TestSaveWritesOneEntryPerLine(t *testing.T) { func TestSavedFileIsStillValidJSONForTheOtherImplementation(t *testing.T) { c := tmpCache(t) - want := Geo{Lat: 50.06170, Lon: 19.93730, Label: "Krakow, PL", Country: "PL"} + want := Geo{Lat: 50.06174, Lon: 19.93732, Label: "Krakow, PL", Country: "PL"} if err := c.PutGeo("Krakow", want); err != nil { t.Fatal(err) } -- cgit v1.3