Skip to content

Commit 31687dc

Browse files
authored
testing: Remove console output while running unit tests (#176)
1 parent aab8de1 commit 31687dc

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

changes_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ func TestChangesService_CreateChange(t *testing.T) {
143143
if err != nil {
144144
t.Error(err)
145145
}
146-
t.Logf("Request payload:\n%s", jsonStr)
146+
if len(jsonStr) == 0 {
147+
t.Error("Empty request payload")
148+
}
147149

148150
required := func(field string) string {
149151
value, ok := payload[field]

projects_access_test.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ func TestProjectsService_ListAccessRights(t *testing.T) {
2727
t.Errorf("project: list access rights error: %s", err)
2828
}
2929

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)