mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
@@ -372,12 +372,16 @@ func TestShortcodeInstagram(t *testing.T) {
|
||||
} {
|
||||
// overload getJSON to return mock API response from Instagram
|
||||
instagramFuncMap := template.FuncMap{
|
||||
"getJSON": func(urlParts ...string) interface{} {
|
||||
"getJSON": func(args ...interface{}) interface{} {
|
||||
headers := args[len(args)-1].(map[string]interface{})
|
||||
auth := headers["Authorization"]
|
||||
if auth != "Bearer dummytoken" {
|
||||
return fmt.Errorf("invalid access token: %q", auth)
|
||||
}
|
||||
var v interface{}
|
||||
err := json.Unmarshal([]byte(this.resp), &v)
|
||||
if err != nil {
|
||||
t.Fatalf("[%d] unexpected error in json.Unmarshal: %s", i, err)
|
||||
return err
|
||||
return fmt.Errorf("[%d] unexpected error in json.Unmarshal: %s", i, err)
|
||||
}
|
||||
return v
|
||||
},
|
||||
@@ -388,6 +392,8 @@ func TestShortcodeInstagram(t *testing.T) {
|
||||
th = newTestHelper(cfg, fs, t)
|
||||
)
|
||||
|
||||
cfg.Set("services.instagram.accessToken", "dummytoken")
|
||||
|
||||
writeSource(t, fs, filepath.Join("content", "simple.md"), fmt.Sprintf(`---
|
||||
title: Shorty
|
||||
---
|
||||
|
Reference in New Issue
Block a user