github.com/go-chef/chef@v0.30.1/updated_since_test.go (about)

     1  package chef
     2  
     3  import (
     4  	"fmt"
     5  	"net/http"
     6  	"strings"
     7  	"testing"
     8  )
     9  
    10  func TestUpdatedSinceGet(t *testing.T) {
    11  	setup()
    12  	defer teardown()
    13  
    14  	mux.HandleFunc("/updated_since", func(w http.ResponseWriter, r *http.Request) {
    15  		switch {
    16  		case r.Method == "GET":
    17  			w.WriteHeader(404)
    18  		}
    19  	})
    20  
    21  	_, err := client.UpdatedSince.Get(1)
    22  	if !strings.Contains(fmt.Sprint(err), "404") {
    23  		t.Errorf("Non 404 return code: %+v", err)
    24  	}
    25  }