-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add media:thumbnail and itunes:image to generated rss feeds #65
Conversation
14d806b
to
04f2d5e
Compare
app/api/server.go
Outdated
baseURL := s.Conf.System.BaseURL | ||
rss.Link = baseURL + "/feed/" + feedName | ||
rss.ItunesImage = feed.ItunesImg{ | ||
URL: baseURL + "/image/" + feedName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't form this image URL automatically but rather conditionally from s.Conf.Feeds[feedName].Image (if not empty)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost ;) the image url should be baseURL+s.Conf.Feeds[feedName].Image
instead of generic baseURL + "/image/" + feedName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah got it now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx, looking good.
As we touched RSS output, could you pls add a test checking generated RSS, with and without images
Ok will add |
@umputun could you please guide me to the right direction with tests? since there are no existing tests for generated feeds, do I have to create tests for handler And it would look something like that:
|
in fact this server wasn't too testable. I have added ctx param to Run so the integration test could terminate it and extracted router() func, so you could pass it into httptest.Server regarding the test itself - all you need to start it to make a testing boltdb and config filled with whatever you need and pass it in. After this, you can call bolt's save for several records and should be good to go. so, your test would look like: tmpfile := filepath.Join(os.TempDir(), "test.db")
defer os.Remove(tmpfile)
db, err := bolt.Open(tmpfile, 0o600, &bolt.Options{Timeout: 1 * time.Second})
require.NoError(t, err)
boltStore := &proc.BoltDB{DB: db}
conf := config.Conf{.....}
srv := Server{Store: boltStore, Conf: conf}
ts := httptest.Server(srv.router())
defer ts.Close() From this point, you could send the real http request to ts.URL + "/whatever" and check the response hope it helps |
add media:thumbnail tag
fix rebase conflict
that helps, thanks |
wanna me to merge this pr as-is and you could add test(s) in the following pr? |
yes lets do that |
PR for #64