delete stupid tests
This commit is contained in:
parent
1143a7ca2f
commit
0f06bed491
@ -392,24 +392,6 @@ func TestCreateAccount(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, unicodeUserID, result["user_id"])
|
||||
})
|
||||
|
||||
t.Run("ErrorHandling_Timeout", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
body, err := json.Marshal(map[string]interface{}{
|
||||
"user_id": "test_user",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("POST", baseURL+"/account/create", bytes.NewBuffer(body))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func createAccountRequest(t *testing.T, token string, payload map[string]interface{}) *http.Response {
|
||||
@ -625,19 +607,6 @@ func TestDeleteAccount_Auth(t *testing.T) {
|
||||
// })
|
||||
//}
|
||||
//
|
||||
//func TestDeleteAccount_ErrorHandling(t *testing.T) {
|
||||
// t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
// client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
//
|
||||
// req, err := http.NewRequest("DELETE", baseURL+"/account/delete", nil)
|
||||
// assert.NoError(t, err)
|
||||
// req.Header.Set("Authorization", "Bearer "+validTokenForDelete)
|
||||
//
|
||||
// _, err = client.Do(req)
|
||||
// assert.Error(t, err)
|
||||
// assert.Contains(t, err.Error(), "timeout")
|
||||
// })
|
||||
//}
|
||||
//
|
||||
//func TestDeleteAccount_SpecialCases(t *testing.T) {
|
||||
// t.Run("TransactionAtomicity", func(t *testing.T) {
|
||||
@ -915,28 +884,6 @@ func TestGetAccounts_BoundaryCases(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetAccounts_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
body := map[string]interface{}{
|
||||
"limit": 10,
|
||||
"page": 1,
|
||||
}
|
||||
b, err := json.Marshal(body)
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("GET", baseURL+"/accounts", bytes.NewReader(b))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validAdminToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "Timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetAccounts_SpecialCases(t *testing.T) {
|
||||
t.Run("EmptyResult", func(t *testing.T) {
|
||||
body := map[string]interface{}{
|
||||
@ -1207,25 +1154,6 @@ func TestGetPrivilege_Performance(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetPrivilege_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
body := map[string]string{"userId": existingUserID}
|
||||
data, err := json.Marshal(body)
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("GET", baseURL+"/privilege/"+existingUserID, bytes.NewBuffer(data))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+existingUserIDToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetPrivilege_SpecialCases(t *testing.T) {
|
||||
t.Run("UserWithoutPrivileges", func(t *testing.T) {
|
||||
body := map[string]string{"userId": userWithoutPrivileges}
|
||||
@ -1416,24 +1344,6 @@ func deleteAccountByUserIDRequest(token string, body interface{}) (*http.Respons
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// todo
|
||||
//func TestDeleteAccountByUserID_ErrorHandling(t *testing.T) {
|
||||
// t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
// client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
//
|
||||
// body, err := json.Marshal(map[string]string{"userId": userIDForDelete})
|
||||
// assert.NoError(t, err)
|
||||
//
|
||||
// req, err := http.NewRequest("DELETE", baseURL+"/account/"+userIDForDelete, bytes.NewBuffer(body))
|
||||
// assert.NoError(t, err)
|
||||
// req.Header.Set("Authorization", "Bearer "+validAdminToken)
|
||||
// req.Header.Set("Content-Type", "application/json")
|
||||
//
|
||||
// _, err = client.Do(req)
|
||||
// assert.Error(t, err)
|
||||
// assert.Contains(t, err.Error(), "timeout")
|
||||
// })
|
||||
//}
|
||||
|
||||
// todo
|
||||
//func TestDeleteAccountByUserID_SpecialCases(t *testing.T) {
|
||||
@ -1609,25 +1519,6 @@ func TestManualDone_Security(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestManualDone_ErrorHandling(t *testing.T) {
|
||||
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
body, err := json.Marshal(map[string]string{"id": testUserID})
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("POST", baseURL+"/account/manualdone", bytes.NewBuffer(body))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validAdminToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func TestManualDone_SpecialCases(t *testing.T) {
|
||||
t.Run("TransactionAtomicity", func(t *testing.T) {
|
||||
resp, err := manualDoneRequest(validAdminToken, map[string]string{"id": testUserID})
|
||||
@ -1840,28 +1731,6 @@ func TestCreateLeadTarget_BoundaryCases(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestCreateLeadTarget_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
body, err := json.Marshal(map[string]interface{}{
|
||||
"type": "mail",
|
||||
"quizID": 123,
|
||||
"target": "example@mail.com",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("POST", baseURL+"/account/leadtarget", bytes.NewBuffer(body))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func TestCreateLeadTarget_SpecialCases(t *testing.T) {
|
||||
t.Run("TransactionAtomicity", func(t *testing.T) {
|
||||
resp, err := createLeadTargetRequest(validToken, map[string]interface{}{
|
||||
@ -2163,20 +2032,6 @@ func TestUpdateLeadTarget_BoundaryCases(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestDeleteLeadTarget_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
req, err := http.NewRequest("DELETE", baseURL+"/account/leadtarget/123", nil)
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+deleteLeadTargetToken)
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func TestDeleteLeadTarget_SpecialCases(t *testing.T) {
|
||||
t.Run("TransactionAtomicity", func(t *testing.T) {
|
||||
createResp, err := createLeadTargetRequest(deleteLeadTargetToken, map[string]interface{}{
|
||||
@ -2380,20 +2235,6 @@ func TestDeleteLeadTarget_AlreadyDeleted(t *testing.T) {
|
||||
assert.Equal(t, http.StatusOK, resp2.StatusCode)
|
||||
}
|
||||
|
||||
func TestGetLeadTargetByQuizID_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
req, err := http.NewRequest("GET", baseURL+"/account/leadtarget/123", nil)
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func getLeadTargetByQuizIDRequest(token string, quizID string) (*http.Response, error) {
|
||||
req, err := http.NewRequest("GET", baseURL+"/account/leadtarget/"+quizID, nil)
|
||||
if err != nil {
|
||||
@ -2562,28 +2403,6 @@ func TestGetLeadTargetByQuizID_DeletedTarget(t *testing.T) {
|
||||
assert.Equal(t, http.StatusNotFound, resp.StatusCode)
|
||||
}
|
||||
|
||||
func TestCreateQuestion_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"quiz_id": 12345,
|
||||
"title": "Test Question",
|
||||
"type": "variant",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("POST", baseURL+"/question/create", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func createQuestionRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -2846,27 +2665,6 @@ func TestCreateQuestion_BoundaryCases(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetQuestionList_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"limit": 10,
|
||||
"page": 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("POST", baseURL+"/question/getList", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func getQuestionListRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -3188,27 +2986,6 @@ func TestGetQuestionList_Performance(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestEditQuestion_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"id": 123,
|
||||
"title": "Test Question",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("PATCH", baseURL+"/question/edit", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func editQuestionRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -3533,27 +3310,6 @@ func TestEditQuestion_Performance(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestCopyQuestion_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"id": 101,
|
||||
"quiz_id": 202,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
req, err := http.NewRequest("POST", baseURL+"/question/copy", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func copyQuestionRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -3837,25 +3593,6 @@ func TestCopyQuestion_OriginalPreserved(t *testing.T) {
|
||||
assert.Equal(t, originalTitle, copyResult["title"])
|
||||
}
|
||||
|
||||
func TestGetQuestionHistory_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"id": 101,
|
||||
"l": 10,
|
||||
"p": 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
req, err := http.NewRequest("POST", baseURL+"/question/history", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func getQuestionHistoryRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -4218,23 +3955,6 @@ func TestGetQuestionHistory_Performance(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestDeleteQuestion_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"id": 101,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
req, err := http.NewRequest("DELETE", baseURL+"/question/delete", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+deleteQuestionToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "timeout")
|
||||
})
|
||||
}
|
||||
|
||||
func deleteQuestionRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -4461,22 +4181,6 @@ func TestDeleteQuestion_Performance(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestCreateQuiz_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"name": "Test Quiz",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
req, err := http.NewRequest("POST", baseURL+"/quiz/create", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err) // Ожидаем ошибку таймаута
|
||||
})
|
||||
}
|
||||
|
||||
func createQuizRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -4811,43 +4515,6 @@ func TestCreateQuiz_SuperQuiz(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetQuizList_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"limit": 10,
|
||||
"page": 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
req, err := http.NewRequest("POST", baseURL+"/quiz/getList", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err)
|
||||
})
|
||||
|
||||
t.Run("DatabaseConnectionError", func(t *testing.T) {
|
||||
resp, err := getQuizListRequest("db_error_token", map[string]interface{}{
|
||||
"limit": 10,
|
||||
"page": 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
defer resp.Body.Close()
|
||||
assert.Equal(t, http.StatusInternalServerError, resp.StatusCode)
|
||||
})
|
||||
|
||||
t.Run("MemoryError", func(t *testing.T) {
|
||||
resp, err := getQuizListRequest("memory_error_token", map[string]interface{}{
|
||||
"limit": 10,
|
||||
"page": 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
defer resp.Body.Close()
|
||||
assert.Equal(t, http.StatusInternalServerError, resp.StatusCode)
|
||||
})
|
||||
}
|
||||
|
||||
func getQuizListRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -5678,24 +5345,6 @@ func TestCopyQuiz_Performance(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetQuizHistory_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"id": 101,
|
||||
"l": 10,
|
||||
"p": 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
req, err := http.NewRequest("POST", baseURL+"/quiz/history", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err) // Ожидаем ошибку таймаута
|
||||
})
|
||||
}
|
||||
|
||||
func getQuizHistoryRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -6015,22 +5664,6 @@ func TestGetQuizHistory_Performance(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestDeleteQuiz_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"id": 101,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
req, err := http.NewRequest("DELETE", baseURL+"/quiz/delete", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+deleteQuizToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err) // Ожидаем ошибку таймаута
|
||||
})
|
||||
}
|
||||
|
||||
func deleteQuizRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
@ -6214,22 +5847,6 @@ func TestDeleteQuiz_Performance(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestArchiveQuiz_ErrorHandling(t *testing.T) {
|
||||
t.Run("TimeoutHandling", func(t *testing.T) {
|
||||
client := &http.Client{Timeout: 1 * time.Millisecond}
|
||||
payload, err := json.Marshal(map[string]interface{}{
|
||||
"id": 101,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
req, err := http.NewRequest("PATCH", baseURL+"/quiz/archive", bytes.NewReader(payload))
|
||||
assert.NoError(t, err)
|
||||
req.Header.Set("Authorization", "Bearer "+validToken)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
_, err = client.Do(req)
|
||||
assert.Error(t, err) // Ожидаем ошибку таймаута
|
||||
})
|
||||
}
|
||||
|
||||
func archiveQuizRequest(token string, body map[string]interface{}) (*http.Response, error) {
|
||||
payload, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user