mirror of
https://github.com/elyby/chrly.git
synced 2024-11-14 09:16:23 +05:30
04714543b8
Упразднён пакет utils. Удалён обработчик minecraft.php (legacy с самого-самого начала Ely.by) Добавлены тесты для всех api-запросов.
29 lines
634 B
Go
29 lines
634 B
Go
package http
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
testify "github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestConfig_NotFound(t *testing.T) {
|
|
assert := testify.New(t)
|
|
|
|
req := httptest.NewRequest("GET", "http://skinsystem.ely.by/", nil)
|
|
w := httptest.NewRecorder()
|
|
|
|
(&Config{}).CreateHandler().ServeHTTP(w, req)
|
|
|
|
resp := w.Result()
|
|
assert.Equal(404, resp.StatusCode)
|
|
assert.Equal("application/json", resp.Header.Get("Content-Type"))
|
|
response, _ := ioutil.ReadAll(resp.Body)
|
|
assert.JSONEq(`{
|
|
"status": "404",
|
|
"message": "Not Found",
|
|
"link": "http://docs.ely.by/skin-system.html"
|
|
}`, string(response))
|
|
}
|