add ut for GetAllProjects()

This commit is contained in:
Wenkai Yin 2016-05-10 22:08:36 +08:00
parent 48be0a988d
commit 3b8baf0139

View File

@ -631,10 +631,10 @@ func TestProjectPermission(t *testing.T) {
} }
} }
func TestQueryRelevantProjects(t *testing.T) { func TestGetUserRelevantProjects(t *testing.T) {
projects, err := GetUserRelevantProjects(currentUser.UserID) projects, err := GetUserRelevantProjects(currentUser.UserID)
if err != nil { if err != nil {
t.Errorf("Error occurred in QueryRelevantProjects: %v", err) t.Errorf("Error occurred in GetUserRelevantProjects: %v", err)
} }
if len(projects) != 2 { if len(projects) != 2 {
t.Errorf("Expected length of relevant projects is 2, but actual: %d, the projects: %+v", len(projects), projects) t.Errorf("Expected length of relevant projects is 2, but actual: %d, the projects: %+v", len(projects), projects)
@ -644,6 +644,13 @@ func TestQueryRelevantProjects(t *testing.T) {
} }
} }
func TestGetAllProjects(t *testing.T) {
_, err := GetAllProjects()
if err != nil {
t.Errorf("Error occurred in GetAllProjects: %v", err)
}
}
func TestAddProjectMember(t *testing.T) { func TestAddProjectMember(t *testing.T) {
err := AddProjectMember(currentProject.ProjectID, 1, models.DEVELOPER) err := AddProjectMember(currentProject.ProjectID, 1, models.DEVELOPER)
if err != nil { if err != nil {