feat(sources): retire Yahoo and CNBC feeds (#42)

This commit is contained in:
2026-11-25 02:00:25 +01:00
parent 7a342f240d
commit 0503c2653f
41 changed files with 603 additions and 173 deletions

View File

@ -36,7 +36,12 @@ func TestAdminSourcesExposeSupportStateAndRejectHistoricalUpdateAtomicallyPostgr
t.Fatal(err)
}
t.Cleanup(func() { _, _ = db.Exec(`DROP SCHEMA ` + pq.QuoteIdentifier(schema) + ` CASCADE`); _ = db.Close() })
for _, q := range []string{`CREATE TABLE users(id TEXT PRIMARY KEY,email TEXT,role TEXT,password_hash TEXT,created_at TIMESTAMPTZ DEFAULT NOW(),updated_at TIMESTAMPTZ DEFAULT NOW())`, `INSERT INTO users(id,email,role,password_hash) VALUES('admin-id','admin@example.test','admin','hash')`, `CREATE TABLE sources(id TEXT PRIMARY KEY,name TEXT,type TEXT,enabled BOOLEAN,article_limit INTEGER DEFAULT 20,source_key TEXT,created_at TIMESTAMPTZ DEFAULT NOW())`, `INSERT INTO sources(id,name,type,enabled,article_limit,source_key) VALUES('old-id','Reuters','reuters',true,42,NULL),('y-id','Yahoo Finance','stocktwits',true,83,'yahoo_finance')`} {
for _, q := range []string{`CREATE TABLE users(id TEXT PRIMARY KEY,email TEXT,role TEXT,password_hash TEXT,created_at TIMESTAMPTZ DEFAULT NOW(),updated_at TIMESTAMPTZ DEFAULT NOW())`, `INSERT INTO users(id,email,role,password_hash) VALUES('admin-id','admin@example.test','admin','hash')`, `CREATE TABLE sources(id TEXT PRIMARY KEY,name TEXT,type TEXT,enabled BOOLEAN,article_limit INTEGER DEFAULT 20,source_key TEXT,created_at TIMESTAMPTZ DEFAULT NOW())`, `INSERT INTO sources(id,name,type,enabled,article_limit,source_key) VALUES('old-id','Reuters','reuters',true,42,NULL),('b-id','Bloomberg','bloomberg',true,83,'bloomberg')`} {
if _, err = db.Exec(q); err != nil {
t.Fatal(err)
}
}
for _, q := range []string{`CREATE TABLE source_feeds(source_id TEXT,position INT,url TEXT)`, `INSERT INTO source_feeds VALUES('b-id',0,'https://feed.quanwenrss.com/feed/bloomberg-latest.xml')`} {
if _, err = db.Exec(q); err != nil {
t.Fatal(err)
}
@ -67,7 +72,7 @@ func TestAdminSourcesExposeSupportStateAndRejectHistoricalUpdateAtomicallyPostgr
if row["id"] == "old-id" {
old = row
}
if row["id"] == "y-id" {
if row["id"] == "b-id" {
supported = row
}
}
@ -90,7 +95,7 @@ func TestAdminSourcesExposeSupportStateAndRejectHistoricalUpdateAtomicallyPostgr
if supported == nil {
t.Fatalf("GET omitted supported source: %s", get.Body.String())
}
for field, want := range map[string]any{"source_key": "yahoo_finance", "supported": true, "operational": true} {
for field, want := range map[string]any{"source_key": "bloomberg", "supported": true, "operational": true} {
if supported[field] != want {
t.Errorf("supported source %s=%v, want %v; row=%v", field, supported[field], want, supported)
}