Skip to content

Commit

Permalink
feat: simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Apr 24, 2023
1 parent d870d83 commit 9112c7e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/cli/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,4 +506,27 @@ func TestGateway(t *testing.T) {
})
})
})

t.Run("OnlyTrustless Enabled", func(t *testing.T) {
// Trusted and trustless responses are tested in more detail in Boxo.
t.Parallel()
node := harness.NewT(t).NewNode().Init()
node.UpdateConfig(func(cfg *config.Config) {
cfg.Gateway.OnlyTrustless = config.True
})
node.StartDaemon()

cidFoo := node.IPFSAddStr("foo")

t.Run("trusted response fails", func(t *testing.T) {
t.Parallel()
assert.Equal(t, http.StatusNotImplemented, node.GatewayClient().Get("/ipfs/"+cidFoo).StatusCode)
})

t.Run("trustless response succeeds", func(t *testing.T) {
t.Parallel()
assert.Equal(t, http.StatusOK, node.GatewayClient().Get("/ipfs/"+cidFoo+"?format=raw").StatusCode)
})
})

}

0 comments on commit 9112c7e

Please sign in to comment.