Skip to content

Commit

Permalink
testing: Remove console output while running unit tests (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrunwald authored Oct 30, 2024
1 parent aab8de1 commit 31687dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 3 additions & 1 deletion changes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ func TestChangesService_CreateChange(t *testing.T) {
if err != nil {
t.Error(err)
}
t.Logf("Request payload:\n%s", jsonStr)
if len(jsonStr) == 0 {
t.Error("Empty request payload")
}

required := func(field string) string {
value, ok := payload[field]
Expand Down
20 changes: 16 additions & 4 deletions projects_access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ func TestProjectsService_ListAccessRights(t *testing.T) {
t.Errorf("project: list access rights error: %s", err)
}

fmt.Printf("project access rights: %v\n", projectAccessRight)
// Doing one deep check to verify the mapping
if projectAccessRight.InheritsFrom.Name != "All-Projects" {
t.Errorf("projectAccessRight.InheritsFrom.Name not matching. Expected '%s', got '%s'", "All-Projects", projectAccessRight.InheritsFrom.Name)
}
}

func TestProjectsService_AddUpdateDeleteAccessRights(t *testing.T) {
Expand All @@ -53,7 +56,10 @@ func TestProjectsService_AddUpdateDeleteAccessRights(t *testing.T) {
t.Errorf("project: add/update/delete access right error: %s", err)
}

fmt.Printf("project access rights: %v\n", projectAccessRight)
// Doing one deep check to verify the mapping
if projectAccessRight.InheritsFrom.Name != "All-Projects" {
t.Errorf("projectAccessRight.InheritsFrom.Name not matching. Expected '%s', got '%s'", "All-Projects", projectAccessRight.InheritsFrom.Name)
}
}

func TestProjectsService_AccessCheck(t *testing.T) {
Expand Down Expand Up @@ -84,7 +90,10 @@ func TestProjectsService_AccessCheck(t *testing.T) {
t.Errorf("project: access check error: %s", err)
}

fmt.Printf("project access check info: %v\n", accessCheckInfo)
// Doing one deep check to verify the mapping
if accessCheckInfo.Status != 403 {
t.Errorf("accessCheckInfo.Status not matching. Expected '%d', got '%d'", 403, accessCheckInfo.Status)
}
}

func TestProjectsService_CreateAccessChange(t *testing.T) {
Expand All @@ -110,5 +119,8 @@ func TestProjectsService_CreateAccessChange(t *testing.T) {
t.Errorf("project: create access change error: %s", err)
}

fmt.Printf("project create access change info: %v\n", changeInfo)
// Doing one deep check to verify the mapping
if changeInfo.ChangeID != "Ieaf185bf90a1fc3b58461e399385e158a20b31a2" {
t.Errorf("changeInfo.ChangeID not matching. Expected '%s', got '%s'", "Ieaf185bf90a1fc3b58461e399385e158a20b31a2", changeInfo.ChangeID)
}
}

0 comments on commit 31687dc

Please sign in to comment.