Some error handling work

This commit is contained in:
2020-01-03 14:13:39 -05:00
parent 0ea6e18fb9
commit 15c4090a94
13 changed files with 1615 additions and 2850 deletions

View File

@@ -37,12 +37,13 @@ func TestCreateGetProject(t *testing.T) {
getResp := getProjectAsAdmin(id).Content
if getResp.Project.Id != id {
if getResp.Project == nil || getResp.Project.Id != id {
t.Error()
}
if getResp.Project.Name != "Test name" {
if getResp.Project == nil || getResp.Project.Name != "Test name" {
t.Error()
return
}
if getResp.Project.Version != "Test Version" {
@@ -147,8 +148,9 @@ func TestUpdateProjectValid(t *testing.T) {
proj := getProjectAsAdmin(pid).Content
if proj.Project.Public != false {
if proj.Project == nil || proj.Project.Public != false {
t.Error()
return
}
if proj.Project.Motd != "MotdB" {
t.Error()
@@ -314,7 +316,8 @@ func TestHiddenProjectsNotShownInList(t *testing.T) {
}, testUserCtx)
if r.Ok != true {
t.Error()
t.Fail()
return
}
list := getProjectList(nil)
@@ -417,6 +420,11 @@ func TestUserWithReadAccessShouldSeeHiddenProjectInList(t *testing.T) {
list := getProjectList(testUserCtx)
if list.Content.Projects == nil {
t.Fail()
return
}
found := false
for _, p := range *list.Content.Projects {
if p.Id == pHidden.Content.Id {
@@ -441,6 +449,11 @@ func TestAdminShouldSeeHiddenProjectInList(t *testing.T) {
list := getProjectList(testAdminCtx)
if list.Content.Projects == nil {
t.Fail()
return
}
found := false
for _, p := range *list.Content.Projects {
if p.Id == pHidden.Content.Id {