mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
golangci-lint v1.48 and fixes for "usestdlibvars" (#1711)
This commit is contained in:
parent
15a9e16530
commit
eea07b7a1a
19 changed files with 65 additions and 57 deletions
|
@ -23,7 +23,7 @@ func TestLogin(t *testing.T) {
|
|||
|
||||
// Login with machine not validated yet
|
||||
w := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest("POST", "/v1/watchers/login", strings.NewReader(body))
|
||||
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader(body))
|
||||
req.Header.Add("User-Agent", UserAgent)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
|
@ -32,7 +32,7 @@ func TestLogin(t *testing.T) {
|
|||
|
||||
// Login with machine not exist
|
||||
w = httptest.NewRecorder()
|
||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test1\", \"password\": \"test1\"}"))
|
||||
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test1\", \"password\": \"test1\"}"))
|
||||
req.Header.Add("User-Agent", UserAgent)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
|
@ -41,7 +41,7 @@ func TestLogin(t *testing.T) {
|
|||
|
||||
// Login with invalid body
|
||||
w = httptest.NewRecorder()
|
||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("test"))
|
||||
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("test"))
|
||||
req.Header.Add("User-Agent", UserAgent)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
|
@ -50,7 +50,7 @@ func TestLogin(t *testing.T) {
|
|||
|
||||
// Login with invalid format
|
||||
w = httptest.NewRecorder()
|
||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test1\"}"))
|
||||
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test1\"}"))
|
||||
req.Header.Add("User-Agent", UserAgent)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
|
@ -65,7 +65,7 @@ func TestLogin(t *testing.T) {
|
|||
|
||||
// Login with invalid password
|
||||
w = httptest.NewRecorder()
|
||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test\", \"password\": \"test1\"}"))
|
||||
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test\", \"password\": \"test1\"}"))
|
||||
req.Header.Add("User-Agent", UserAgent)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
|
@ -74,7 +74,7 @@ func TestLogin(t *testing.T) {
|
|||
|
||||
// Login with valid machine
|
||||
w = httptest.NewRecorder()
|
||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader(body))
|
||||
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader(body))
|
||||
req.Header.Add("User-Agent", UserAgent)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
|
@ -84,7 +84,7 @@ func TestLogin(t *testing.T) {
|
|||
|
||||
// Login with valid machine + scenarios
|
||||
w = httptest.NewRecorder()
|
||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test\", \"password\": \"test\", \"scenarios\": [\"crowdsecurity/test\", \"crowdsecurity/test2\"]}"))
|
||||
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test\", \"password\": \"test\", \"scenarios\": [\"crowdsecurity/test\", \"crowdsecurity/test2\"]}"))
|
||||
req.Header.Add("User-Agent", UserAgent)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue