advancing

Former-commit-id: 0ea003b2683a6174d3d304e4bd32dd01540b87df
This commit is contained in:
bel
2019-06-22 13:48:27 -06:00
parent c0c88502c4
commit 84d5906d9b
8 changed files with 62 additions and 79 deletions

View File

@@ -77,7 +77,7 @@ func TestRSSFeedSaveLoad(t *testing.T) {
}
g := newFeed("key")
if err := g.load(); err != nil {
if err := g.Load(); err != nil {
t.Fatal(err)
}
@@ -88,7 +88,7 @@ func TestRSSFeedSaveLoad(t *testing.T) {
}
h := newFeed("key2")
if err := h.load(); err == nil {
if err := h.Load(); err == nil {
t.Fatal("can load nil feed")
}
}
@@ -116,14 +116,14 @@ func TestRSSFeedPull(t *testing.T) {
t.Errorf("updated is wrong: %v", f)
}
keys, err := config.Values().DB.List([]string{nsItems})
keys, err := config.Values().DB.List([]string{nsItems, f.Key})
if err != nil {
t.Fatal(err)
}
if len(keys) < 1 {
t.Fatal(len(keys))
}
if keys[0] != "https://roosterteeth.com/episode/rooster-teeth-podcast-2018-rooster-teeth-podcast-500" {
if keys[0] != "2018-07-10-19-00:https://roosterteeth.com/episode/rooster-teeth-podcast-2018-rooster-teeth-podcast-500" {
t.Fatal(keys[0])
}
@@ -133,7 +133,7 @@ func TestRSSFeedPull(t *testing.T) {
t.Fatal(err)
}
log.SetOutput(os.Stderr)
keysB, err := config.Values().DB.List([]string{nsItems})
keysB, err := config.Values().DB.List([]string{nsItems, f.Key})
if err != nil {
t.Fatal(err)
}
@@ -141,10 +141,22 @@ func TestRSSFeedPull(t *testing.T) {
t.Fatalf("%v vs %v", keys, keysB)
}
i := &Item{
Link: keys[0],
itemKeys, err := f.List(5)
if err != nil {
t.Fatal(err)
}
if err := i.load(); err != nil {
if len(itemKeys) < 1 {
t.Fatal(len(itemKeys))
}
if len(itemKeys) > 5 {
t.Fatal(len(itemKeys))
}
if itemKeys[0] != "2018-07-10-19-00:https://roosterteeth.com/episode/rooster-teeth-podcast-2018-rooster-teeth-podcast-500" {
t.Fatal(itemKeys[0])
}
i := &Item{}
if err := i.Load(itemKeys[0], f.Key); err != nil {
t.Fatal(err)
}
if *i == (Item{}) {