Merge pull request #8586 from ethan-daocloud/patch-2

project_test.go: many typos "respose" fixup
This commit is contained in:
Wenkai Yin(尹文开) 2019-08-20 13:54:37 +08:00 committed by GitHub
commit 0086d1b211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,7 +172,7 @@ func TestListProjects(t *testing.T) {
}() }()
// ----------------------------case 1 : Response Code=200----------------------------// // ----------------------------case 1 : Response Code=200----------------------------//
fmt.Println("case 1: respose code:200") fmt.Println("case 1: response code:200")
httpStatusCode, result, err := apiTest.ProjectsGet( httpStatusCode, result, err := apiTest.ProjectsGet(
&apilib.ProjectQuery{ &apilib.ProjectQuery{
Name: addProject.ProjectName, Name: addProject.ProjectName,
@ -263,7 +263,7 @@ func TestProGetByID(t *testing.T) {
}() }()
// ----------------------------case 1 : Response Code=200----------------------------// // ----------------------------case 1 : Response Code=200----------------------------//
fmt.Println("case 1: respose code:200") fmt.Println("case 1: response code:200")
httpStatusCode, result, err := apiTest.ProjectsGetByPID(projectID) httpStatusCode, result, err := apiTest.ProjectsGetByPID(projectID)
if err != nil { if err != nil {
t.Error("Error while search project by proID", err.Error()) t.Error("Error while search project by proID", err.Error())
@ -295,7 +295,7 @@ func TestDeleteProject(t *testing.T) {
} }
// --------------------------case 2: Response Code=200---------------------------------// // --------------------------case 2: Response Code=200---------------------------------//
fmt.Println("case2: respose code:200") fmt.Println("case2: response code:200")
httpStatusCode, err = apiTest.ProjectsDelete(*admin, projectID) httpStatusCode, err = apiTest.ProjectsDelete(*admin, projectID)
if err != nil { if err != nil {
t.Error("Error while delete project", err.Error()) t.Error("Error while delete project", err.Error())
@ -335,7 +335,7 @@ func TestProHead(t *testing.T) {
apiTest := newHarborAPI() apiTest := newHarborAPI()
// ----------------------------case 1 : Response Code=200----------------------------// // ----------------------------case 1 : Response Code=200----------------------------//
fmt.Println("case 1: respose code:200") fmt.Println("case 1: response code:200")
httpStatusCode, err := apiTest.ProjectsHead(*admin, "library") httpStatusCode, err := apiTest.ProjectsHead(*admin, "library")
if err != nil { if err != nil {
t.Error("Error while search project by proName", err.Error()) t.Error("Error while search project by proName", err.Error())
@ -345,7 +345,7 @@ func TestProHead(t *testing.T) {
} }
// ----------------------------case 2 : Response Code=404:Project name does not exist.----------------------------// // ----------------------------case 2 : Response Code=404:Project name does not exist.----------------------------//
fmt.Println("case 2: respose code:404,Project name does not exist.") fmt.Println("case 2: response code:404,Project name does not exist.")
httpStatusCode, err = apiTest.ProjectsHead(*admin, "libra") httpStatusCode, err = apiTest.ProjectsHead(*admin, "libra")
if err != nil { if err != nil {
t.Error("Error while search project by proName", err.Error()) t.Error("Error while search project by proName", err.Error())
@ -369,22 +369,22 @@ func TestPut(t *testing.T) {
}, },
} }
fmt.Println("case 1: respose code:200") fmt.Println("case 1: response code:200")
code, err := apiTest.ProjectsPut(*admin, "1", project) code, err := apiTest.ProjectsPut(*admin, "1", project)
require.Nil(t, err) require.Nil(t, err)
assert.Equal(int(200), code) assert.Equal(int(200), code)
fmt.Println("case 2: respose code:401, User need to log in first.") fmt.Println("case 2: response code:401, User need to log in first.")
code, err = apiTest.ProjectsPut(*unknownUsr, "1", project) code, err = apiTest.ProjectsPut(*unknownUsr, "1", project)
require.Nil(t, err) require.Nil(t, err)
assert.Equal(int(401), code) assert.Equal(int(401), code)
fmt.Println("case 3: respose code:400, Invalid project id") fmt.Println("case 3: response code:400, Invalid project id")
code, err = apiTest.ProjectsPut(*admin, "cc", project) code, err = apiTest.ProjectsPut(*admin, "cc", project)
require.Nil(t, err) require.Nil(t, err)
assert.Equal(int(400), code) assert.Equal(int(400), code)
fmt.Println("case 4: respose code:404, Not found the project") fmt.Println("case 4: response code:404, Not found the project")
code, err = apiTest.ProjectsPut(*admin, "1234", project) code, err = apiTest.ProjectsPut(*admin, "1234", project)
require.Nil(t, err) require.Nil(t, err)
assert.Equal(int(404), code) assert.Equal(int(404), code)
@ -407,7 +407,7 @@ func TestProjectLogsFilter(t *testing.T) {
} }
// -------------------case1: Response Code=200------------------------------// // -------------------case1: Response Code=200------------------------------//
fmt.Println("case 1: respose code:200") fmt.Println("case 1: response code:200")
projectID := "1" projectID := "1"
httpStatusCode, _, err := apiTest.ProjectLogs(*admin, projectID, query) httpStatusCode, _, err := apiTest.ProjectLogs(*admin, projectID, query)
if err != nil { if err != nil {
@ -417,7 +417,7 @@ func TestProjectLogsFilter(t *testing.T) {
assert.Equal(int(200), httpStatusCode, "httpStatusCode should be 200") assert.Equal(int(200), httpStatusCode, "httpStatusCode should be 200")
} }
// -------------------case2: Response Code=401:User need to log in first.------------------------------// // -------------------case2: Response Code=401:User need to log in first.------------------------------//
fmt.Println("case 2: respose code:401:User need to log in first.") fmt.Println("case 2: response code:401:User need to log in first.")
projectID = "1" projectID = "1"
httpStatusCode, _, err = apiTest.ProjectLogs(*unknownUsr, projectID, query) httpStatusCode, _, err = apiTest.ProjectLogs(*unknownUsr, projectID, query)
if err != nil { if err != nil {
@ -427,7 +427,7 @@ func TestProjectLogsFilter(t *testing.T) {
assert.Equal(int(401), httpStatusCode, "httpStatusCode should be 401") assert.Equal(int(401), httpStatusCode, "httpStatusCode should be 401")
} }
// -------------------case3: Response Code=404:Project does not exist.-------------------------// // -------------------case3: Response Code=404:Project does not exist.-------------------------//
fmt.Println("case 3: respose code:404:Illegal format of provided ID value.") fmt.Println("case 3: response code:404:Illegal format of provided ID value.")
projectID = "11111" projectID = "11111"
httpStatusCode, _, err = apiTest.ProjectLogs(*admin, projectID, query) httpStatusCode, _, err = apiTest.ProjectLogs(*admin, projectID, query)
if err != nil { if err != nil {
@ -498,7 +498,7 @@ func TestProjectSummary(t *testing.T) {
}() }()
// ----------------------------case 1 : Response Code=200----------------------------// // ----------------------------case 1 : Response Code=200----------------------------//
fmt.Println("case 1: respose code:200") fmt.Println("case 1: response code:200")
httpStatusCode, summary, err := apiTest.ProjectSummary(*admin, fmt.Sprintf("%d", projectID)) httpStatusCode, summary, err := apiTest.ProjectSummary(*admin, fmt.Sprintf("%d", projectID))
if err != nil { if err != nil {
t.Error("Error while search project by proName", err.Error()) t.Error("Error while search project by proName", err.Error())