Skip to content

Commit

Permalink
fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
guettli committed Dec 12, 2024
1 parent 70c5643 commit a589799
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions hcloud/cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func newTestEnv() testEnv {
hcloud.WithEndpoint(server.URL),
hcloud.WithToken("jr5g7ZHpPptyhJzZyHw2Pqu4g9gTqDvEceYpngPf79jNZXCeTYQ4uArypFM3nh75"),
hcloud.WithBackoffFunc(func(_ int) time.Duration { return 0 }),
hcloud.WithDebugWriter(os.Stdout),
)
robotClient := hrobot.NewBasicAuthClient("", "")
robotClient.SetBaseURL(server.URL + "/robot")
Expand Down
28 changes: 16 additions & 12 deletions hcloud/routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ func TestRoutes_CreateRoute(t *testing.T) {
},
})
})
env.Mux.HandleFunc("/actions/1", func(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(schema.NetworkActionAddRouteResponse{
Action: schema.Action{
ID: 1,
Status: string(hcloud.ActionStatusSuccess),
Progress: 100,
env.Mux.HandleFunc("/actions", func(w http.ResponseWriter, _ *http.Request) {
json.NewEncoder(w).Encode(schema.ActionListResponse{
Actions: []schema.Action{
{
ID: 1,
Status: string(hcloud.ActionStatusSuccess),
Progress: 100,
},
},
})
})
Expand Down Expand Up @@ -154,12 +156,14 @@ func TestRoutes_DeleteRoute(t *testing.T) {
},
})
})
env.Mux.HandleFunc("/actions/1", func(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(schema.NetworkActionAddRouteResponse{
Action: schema.Action{
ID: 1,
Status: string(hcloud.ActionStatusSuccess),
Progress: 100,
env.Mux.HandleFunc("/actions", func(w http.ResponseWriter, _ *http.Request) {
json.NewEncoder(w).Encode(schema.ActionListResponse{
Actions: []schema.Action{
{
ID: 1,
Status: string(hcloud.ActionStatusSuccess),
Progress: 100,
},
},
})
})
Expand Down

0 comments on commit a589799

Please sign in to comment.