test: add test that cookie jar loads cookies

This commit is contained in:
James Houlahan
2020-08-13 11:39:28 +02:00
parent 209af59232
commit 66082af40f
3 changed files with 50 additions and 14 deletions

View File

@ -25,7 +25,7 @@ import (
)
type pantry struct {
prefs GetterSetter
gs GetterSetter
}
func (p *pantry) persistCookies(url string, cookies []*http.Cookie) error {
@ -68,7 +68,7 @@ func (p *pantry) loadCookies() (map[string][]*http.Cookie, error) {
type dataStructure map[string]string
func (p *pantry) loadFromJSON() (dataStructure, error) {
b := p.prefs.Get(preferences.CookiesKey)
b := p.gs.Get(preferences.CookiesKey)
if b == "" {
return make(dataStructure), nil
@ -89,7 +89,7 @@ func (p *pantry) saveToJSON(val dataStructure) error {
return err
}
p.prefs.Set(preferences.CookiesKey, string(b))
p.gs.Set(preferences.CookiesKey, string(b))
return nil
}