Skip to content

Commit

Permalink
bypass cache in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Oct 14, 2024
1 parent 1a6f9b8 commit 3d3bdc5
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type server struct {
cfg *cfg.Config
db *sql.DB
dbPath string
handler front.Handler
Alice *ap.Actor
Bob *ap.Actor
Carol *ap.Actor
Expand Down Expand Up @@ -94,16 +93,10 @@ func newTestServer() *server {
panic(err)
}

handler, err := front.NewHandler(domain, false, &cfg, fed.NewResolver(nil, domain, &cfg, &http.Client{}, db), db)
if err != nil {
panic(err)
}

return &server{
cfg: &cfg,
dbPath: path,
db: db,
handler: handler,
Alice: alice,
Bob: bob,
Carol: carol,
Expand All @@ -117,9 +110,14 @@ func (s *server) Handle(request string, user *ap.Actor) string {
panic(err)
}

handler, err := front.NewHandler(domain, false, s.cfg, fed.NewResolver(nil, domain, s.cfg, &http.Client{}, s.db), s.db)
if err != nil {
panic(err)
}

var buf bytes.Buffer
w := gmi.Wrap(&buf)
s.handler.Handle(
handler.Handle(
&front.Request{
Context: context.Background(),
URL: u,
Expand All @@ -140,9 +138,14 @@ func (s *server) Upload(request string, user *ap.Actor, body []byte) string {
}
u.Scheme = "titan"

handler, err := front.NewHandler(domain, false, s.cfg, fed.NewResolver(nil, domain, s.cfg, &http.Client{}, s.db), s.db)
if err != nil {
panic(err)
}

var buf bytes.Buffer
w := gmi.Wrap(&buf)
s.handler.Handle(
handler.Handle(
&front.Request{
Context: context.Background(),
URL: u,
Expand Down

0 comments on commit 3d3bdc5

Please sign in to comment.