"Fossies" - the Fresh Open Source Software Archive

Member "AdGuardHome-0.104.3/internal/dhcpd/dhcphttp_test.go" (19 Nov 2020, 447 Bytes) of package /linux/misc/dns/AdGuardHome-0.104.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package dhcpd
    2 
    3 import (
    4     "net/http"
    5     "net/http/httptest"
    6     "testing"
    7 
    8     "github.com/stretchr/testify/assert"
    9 )
   10 
   11 func TestServer_notImplemented(t *testing.T) {
   12     s := &Server{}
   13     h := s.notImplemented("never!")
   14 
   15     w := httptest.NewRecorder()
   16     r, err := http.NewRequest(http.MethodGet, "/unsupported", nil)
   17     assert.Nil(t, err)
   18 
   19     h(w, r)
   20     assert.Equal(t, http.StatusNotImplemented, w.Code)
   21     assert.Equal(t, `{"message":"never!"}`+"\n", w.Body.String())
   22 }