feat: get image blob in backend (#495)

* feat: get image blob in backend

* chore: update
This commit is contained in:
boojack
2022-11-19 18:43:56 +08:00
committed by GitHub
parent 9036bd478b
commit 2d49e96a8a
10 changed files with 175 additions and 54 deletions

View File

@ -0,0 +1,34 @@
package getter
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestGetHTMLMeta(t *testing.T) {
tests := []struct {
urlStr string
htmlMeta HTMLMeta
}{
{
urlStr: "https://baidu.com",
htmlMeta: HTMLMeta{
Title: "百度一下,你就知道",
},
},
{
urlStr: "https://www.bytebase.com/blog/sql-review-tool-for-devs",
htmlMeta: HTMLMeta{
Title: "The SQL Review Tool for Developers",
Description: "Reviewing SQL can be somewhat tedious, yet is essential to keep your database fleet reliable. At Bytebase, we are building a developer-first SQL review tool to empower the DevOps system.",
Image: "https://www.bytebase.com/static/blog/sql-review-tool-for-devs/dev-fighting-dba.webp",
},
},
}
for _, test := range tests {
metadata, err := GetHTMLMeta(test.urlStr)
require.NoError(t, err)
require.Equal(t, test.htmlMeta, *metadata)
}
}