From 888604fb0ddd7ca362aa3cdee8be0670be3c08b9 Mon Sep 17 00:00:00 2001 From: wemeya Date: Fri, 20 May 2016 17:03:50 +0800 Subject: [PATCH] modify code as travis ci required --- api/log.go | 1 + dao/accesslog.go | 6 +++--- dao/dao_test.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/log.go b/api/log.go index 3ed98d772..63d637f30 100644 --- a/api/log.go +++ b/api/log.go @@ -22,6 +22,7 @@ import ( "github.com/vmware/harbor/utils/log" ) +//LogAPi handles request api/logs type LogAPI struct { BaseAPI userID int diff --git a/dao/accesslog.go b/dao/accesslog.go index db6918304..6d52fb34e 100644 --- a/dao/accesslog.go +++ b/dao/accesslog.go @@ -119,11 +119,11 @@ func AccessLog(username, projectName, repoName, repoTag, action string) error { } //GetRecentLogs returns recent logs according to parameters -func GetRecentLogs(lines int, start_time, end_time string) ([]models.AccessLog, error) { +func GetRecentLogs(lines int, startTime, endTime string) ([]models.AccessLog, error) { var recentLogList []models.AccessLog queryParam := make([]interface{}, 1) - queryParam = append(queryParam, start_time) - queryParam = append(queryParam, end_time) + queryParam = append(queryParam, startTime) + queryParam = append(queryParam, endTime) qb, _ := orm.NewQueryBuilder("mysql") qb.Select("log_id", "user_id", "project_id", "repo_name", "repo_tag", "GUID", "operation", "op_time"). diff --git a/dao/dao_test.go b/dao/dao_test.go index dbe0d9c8f..3965ff20c 100644 --- a/dao/dao_test.go +++ b/dao/dao_test.go @@ -736,7 +736,7 @@ func TestChangeUserProfile(t *testing.T) { t.Errorf("user email does not update, expected: %s, acutal: %s", "Unit Test", loginedUser.Email) } } -func GetRecentLogs(t *testing.T) { +func TestGetRecentLogs(t *testing.T) { logs, err := GetRecentLogs(10, "2016-05-13 00:00:00", time.Now().String()) if err != nil { t.Errorf("error occured in getting recent logs", err)