mcchunkie/got_test.go
Aaron Bieber 1e85d3230c
got: switch to author_user for user name outupt
while here save our payload for later review
2024-04-30 07:48:07 -06:00

33 lines
467 B
Go

package main
import (
"bytes"
"encoding/json"
"fmt"
"os"
"testing"
)
func TestGotNotification(t *testing.T) {
jsonData, err := os.ReadFile("test_body.json")
if err != nil {
t.Fatal(err)
}
nots := &GotNotifications{}
dec := json.NewDecoder(bytes.NewReader(jsonData))
err = dec.Decode(nots)
if err != nil {
t.Fatal(err)
}
err = nots.Save()
if err != nil {
t.Fatal(err)
}
for _, n := range nots.Notifications {
fmt.Println(n.String())
}
}