Fix lint
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
kolaente 2020-06-26 19:55:19 +02:00
parent 831242c4ff
commit 6ae9ea3bee
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 49 additions and 45 deletions

View File

@ -16,7 +16,10 @@
package caldav
import "testing"
import (
"testing"
"time"
)
func TestParseEvents(t *testing.T) {
type args struct {
@ -40,23 +43,23 @@ func TestParseEvents(t *testing.T) {
Summary: "Event #1",
Description: "Lorem Ipsum",
UID: "randommduid",
Timestamp: 1543626724,
Start: 1543626724,
End: 1543627824,
Timestamp: time.Unix(1543626724, 0),
Start: time.Unix(1543626724, 0),
End: time.Unix(1543627824, 0),
},
{
Summary: "Event #2",
UID: "randommduidd",
Timestamp: 1543726724,
Start: 1543726724,
End: 1543738724,
Timestamp: time.Unix(1543726724, 0),
Start: time.Unix(1543726724, 0),
End: time.Unix(1543738724, 0),
},
{
Summary: "Event #3 with empty uid",
UID: "20181202T0600242aaef4a81d770c1e775e26bc5abebc87f1d3d7bffaa83",
Timestamp: 1543726824,
Start: 1543726824,
End: 1543727000,
Timestamp: time.Unix(1543726824, 0),
Start: time.Unix(1543726824, 0),
End: time.Unix(1543727000, 0),
},
},
},
@ -104,44 +107,44 @@ END:VCALENDAR`,
Summary: "Event #1",
Description: "Lorem Ipsum",
UID: "randommduid",
Timestamp: 1543626724,
Start: 1543626724,
End: 1543627824,
Timestamp: time.Unix(1543626724, 0),
Start: time.Unix(1543626724, 0),
End: time.Unix(1543627824, 0),
Alarms: []Alarm{
{Time: 1543626524},
{Time: 1543626224},
{Time: 1543626024},
{Time: time.Unix(1543626524, 0)},
{Time: time.Unix(1543626224, 0)},
{Time: time.Unix(1543626024, 0)},
},
},
{
Summary: "Event #2",
UID: "randommduidd",
Timestamp: 1543726724,
Start: 1543726724,
End: 1543738724,
Timestamp: time.Unix(1543726724, 0),
Start: time.Unix(1543726724, 0),
End: time.Unix(1543738724, 0),
Alarms: []Alarm{
{Time: 1543626524},
{Time: 1543626224},
{Time: 1543626024},
{Time: time.Unix(1543626524, 0)},
{Time: time.Unix(1543626224, 0)},
{Time: time.Unix(1543626024, 0)},
},
},
{
Summary: "Event #3 with empty uid",
Timestamp: 1543726824,
Start: 1543726824,
End: 1543727000,
Timestamp: time.Unix(1543726824, 0),
Start: time.Unix(1543726824, 0),
End: time.Unix(1543727000, 0),
Alarms: []Alarm{
{Time: 1543626524},
{Time: 1543626224},
{Time: 1543626024},
{Time: 1543826824},
{Time: time.Unix(1543626524, 0)},
{Time: time.Unix(1543626224, 0)},
{Time: time.Unix(1543626024, 0)},
{Time: time.Unix(1543826824, 0)},
},
},
{
Summary: "Event #4 without any",
Timestamp: 1543726824,
Start: 1543726824,
End: 1543727000,
Timestamp: time.Unix(1543726824, 0),
Start: time.Unix(1543726824, 0),
End: time.Unix(1543727000, 0),
},
},
},

View File

@ -639,6 +639,7 @@ create unique index UQE_users_namespace_id
sql = append(sql, "ALTER TABLE "+table+" ADD COLUMN "+colFinal+" TIMESTAMP WITHOUT TIME ZONE NULL;")
}
sql = append(sql,
// #nosec
"UPDATE "+table+" SET "+colTmp+" = (CASE WHEN "+colOld+" = 0 THEN NULL ELSE TIMESTAMP 'epoch' + "+colOld+" * INTERVAL '1 second' END);",
"ALTER TABLE "+table+" ALTER COLUMN "+colFinal+" TYPE TIMESTAMP USING "+colTmp+";",
"ALTER TABLE "+table+" DROP COLUMN "+colTmp+";",
@ -650,6 +651,7 @@ create unique index UQE_users_namespace_id
sql = []string{
"ALTER TABLE " + table + " DROP COLUMN IF EXISTS " + colTmp + ";",
"ALTER TABLE " + table + " ADD COLUMN " + colTmp + " DATETIME NULL;",
// #nosec
"UPDATE " + table + " SET " + colTmp + " = IF(" + colOld + " = 0, NULL, FROM_UNIXTIME(" + colOld + "));",
"ALTER TABLE " + table + " DROP COLUMN " + colOld + ";",
"ALTER TABLE " + table + " CHANGE " + colTmp + " " + colFinal + " DATETIME NULL;",
@ -660,10 +662,12 @@ create unique index UQE_users_namespace_id
// But some of the test data is 0 so we can't use our update script on it.
if column != "updated" && column != "created" {
sql = []string{
// #nosec
"UPDATE " + table + " SET " + colFinal + " = CASE WHEN " + colFinal + " > 0 THEN DATETIME(" + colFinal + ", 'unixepoch', 'localtime') ELSE NULL END",
}
} else {
sql = []string{
// #nosec
"UPDATE " + table + " SET " + colFinal + " = DATETIME(" + colFinal + ", 'unixepoch', 'localtime')",
}
}

View File

@ -488,7 +488,6 @@ func TestConvertTodoistToVikunja(t *testing.T) {
Mime: "text/plain",
Size: 12345,
Created: time1,
Created: time1,
FileContent: exampleFile,
},
Created: time1,

View File

@ -202,7 +202,7 @@ func TestWunderlistParsing(t *testing.T) {
Tasks: []*models.Task{
{
Title: "Ipsum1",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
Description: "Lorem Ipsum dolor sit amet",
Attachments: []*models.TaskAttachment{
@ -212,7 +212,6 @@ func TestWunderlistParsing(t *testing.T) {
Mime: "text/plain",
Size: 12345,
Created: time2,
Created: time2,
FileContent: exampleFile,
},
Created: time2,
@ -222,7 +221,7 @@ func TestWunderlistParsing(t *testing.T) {
},
{
Title: "Ipsum2",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
Description: "Lorem Ipsum dolor sit amet",
RelatedTasks: map[models.RelationKind][]*models.Task{
@ -246,7 +245,7 @@ func TestWunderlistParsing(t *testing.T) {
Title: "Ipsum3",
Done: true,
DoneAt: time1,
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
Description: "Lorem Ipsum dolor sit amet",
Attachments: []*models.TaskAttachment{
@ -256,7 +255,6 @@ func TestWunderlistParsing(t *testing.T) {
Mime: "text/plain",
Size: 12345,
Created: time3,
Created: time3,
FileContent: exampleFile,
},
Created: time3,
@ -265,7 +263,7 @@ func TestWunderlistParsing(t *testing.T) {
},
{
Title: "Ipsum4",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
Reminders: []time.Time{time3},
RelatedTasks: map[models.RelationKind][]*models.Task{
@ -284,26 +282,26 @@ func TestWunderlistParsing(t *testing.T) {
Tasks: []*models.Task{
{
Title: "Ipsum5",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
},
{
Title: "Ipsum6",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
Done: true,
DoneAt: time1,
},
{
Title: "Ipsum7",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
Done: true,
DoneAt: time1,
},
{
Title: "Ipsum8",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
},
},
@ -314,14 +312,14 @@ func TestWunderlistParsing(t *testing.T) {
Tasks: []*models.Task{
{
Title: "Ipsum9",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
Done: true,
DoneAt: time1,
},
{
Title: "Ipsum10",
DueDate: 1378339200,
DueDate: time.Unix(1378339200, 0),
Created: time1,
Done: true,
DoneAt: time1,