summaryrefslogtreecommitdiffstats
path: root/hugolib/embedded_shortcodes_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/embedded_shortcodes_test.go')
-rw-r--r--hugolib/embedded_shortcodes_test.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/hugolib/embedded_shortcodes_test.go b/hugolib/embedded_shortcodes_test.go
index 90f2685af..9fb25e22a 100644
--- a/hugolib/embedded_shortcodes_test.go
+++ b/hugolib/embedded_shortcodes_test.go
@@ -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
---