1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-14 16:21:57 -04:00

Add tests for users and sessions

Split out common test infrastructure from security_templates_test, make
tests HTTPS, use the http.Client provided by httptest
This commit is contained in:
2017-10-07 06:21:05 -04:00
parent 2fe25cbb77
commit 8f0f64ae53
6 changed files with 477 additions and 44 deletions

View File

@ -8,6 +8,7 @@ import (
"io"
"log"
"net/http"
"strings"
"time"
)
@ -22,6 +23,11 @@ func (s *Session) Write(w http.ResponseWriter) error {
return enc.Encode(s)
}
func (s *Session) Read(json_str string) error {
dec := json.NewDecoder(strings.NewReader(json_str))
return dec.Decode(s)
}
func GetSession(db *DB, r *http.Request) (*Session, error) {
var s Session