File: error_test.go

package info (click to toggle)
golang-github-ovh-go-ovh 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 192 kB
  • sloc: makefile: 5
file content (21 lines) | stat: -rw-r--r-- 323 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package ovh

import (
	"fmt"
	"net/http"
	"testing"
)

func TestErrorString(t *testing.T) {
	err := &APIError{
		Code:    http.StatusBadRequest,
		Message: "Bad request",
	}

	expected := `Error 400: "Bad request"`
	got := fmt.Sprintf("%s", err)

	if got != expected {
		t.Errorf("expected %q, got %q", expected, got)
	}
}