Rehabilitate all tets

This commit is contained in:
lash 2025-01-05 09:54:19 +00:00
parent f0a4a0df61
commit 437f73827d
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 9 additions and 8 deletions

View File

@ -21,7 +21,6 @@ import (
httpserver "git.grassecon.net/urdt/ussd/internal/http" httpserver "git.grassecon.net/urdt/ussd/internal/http"
"git.grassecon.net/urdt/ussd/internal/storage" "git.grassecon.net/urdt/ussd/internal/storage"
"git.grassecon.net/urdt/ussd/remote" "git.grassecon.net/urdt/ussd/remote"
"git.grassecon.net/urdt/ussd/request"
) )
var ( var (
@ -124,7 +123,11 @@ func main() {
rp := &httpserver.DefaultRequestParser{} rp := &httpserver.DefaultRequestParser{}
bsh := handlers.NewBaseSessionHandler(cfg, rs, stateStore, userdataStore, rp, hl) bsh := handlers.NewBaseSessionHandler(cfg, rs, stateStore, userdataStore, rp, hl)
sh := request.ToSessionHandler(bsh) // TODO: less hacky way of making session handler
//sh := request.ToSessionHandler(bsh)
sh := &httpserver.SessionHandler{
RequestHandler: bsh,
}
s := &http.Server{ s := &http.Server{
Addr: fmt.Sprintf("%s:%s", host, strconv.Itoa(int(port))), Addr: fmt.Sprintf("%s:%s", host, strconv.Itoa(int(port))),
Handler: sh, Handler: sh,

View File

@ -98,7 +98,10 @@ func TestSessionHandler_ServeHTTP(t *testing.T) {
}, },
} }
sessionHandler := request.ToSessionHandler(mockRequestHandler) sessionHandler := &SessionHandler{
RequestHandler: mockRequestHandler,
}
//sessionHandler := request.ToSessionHandler(mockRequestHandler)
req := httptest.NewRequest(http.MethodPost, "/", bytes.NewBuffer(tt.input)) req := httptest.NewRequest(http.MethodPost, "/", bytes.NewBuffer(tt.input))
req.Header.Set("X-Vise-Session", tt.sessionID) req.Header.Set("X-Vise-Session", tt.sessionID)

View File

@ -2,7 +2,6 @@ package request
import ( import (
"context" "context"
"fmt"
"io" "io"
"net/http" "net/http"
"strconv" "strconv"
@ -59,10 +58,6 @@ func (f *SessionHandler) WriteError(w http.ResponseWriter, code int, err error)
} }
} }
func (f *SessionHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
f.WriteError(w, 500, fmt.Errorf("not implemented"))
}
func ToSessionHandler(h RequestHandler) *SessionHandler { func ToSessionHandler(h RequestHandler) *SessionHandler {
return &SessionHandler{ return &SessionHandler{
RequestHandler: h, RequestHandler: h,