-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
file_sync_fixtures.go
75 lines (67 loc) · 2.02 KB
/
file_sync_fixtures.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package entity
import (
"time"
)
type FileSyncMap map[string]FileSync
func (m FileSyncMap) Get(name string, accountID uint, remoteName string) FileSync {
if result, ok := m[name]; ok {
return result
}
return *NewFileSync(accountID, remoteName)
}
func (m FileSyncMap) Pointer(name string, accountID uint, remoteName string) *FileSync {
if result, ok := m[name]; ok {
return &result
}
return NewFileSync(accountID, remoteName)
}
var FileSyncFixtures = FileSyncMap{
"FileSync1": {
FileID: 1000000,
ServiceID: 1000000,
RemoteName: "/20200706-092527-Landscape-München-2020.jpg",
Status: "uploaded",
Error: "",
Errors: 0,
File: &FileFixturesExampleJPG,
Account: &ServiceFixtureWebdavDummy,
RemoteDate: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
RemoteSize: int64(888),
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
},
"FileSync2": {
FileID: 1000000,
ServiceID: 1000001,
RemoteName: "/20200706-092527-Landscape-Hamburg-2020.jpg",
Status: "downloaded",
Error: "",
Errors: 0,
File: &FileFixturesExampleJPG,
Account: &ServiceFixtureWebdavDummy2,
RemoteDate: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
RemoteSize: int64(160),
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
},
"FileSync3": {
FileID: 1000000,
ServiceID: 1000000,
RemoteName: "/20200706-092527-People-2020.jpg",
Status: "new",
Error: "",
Errors: 0,
File: &FileFixturesExampleJPG,
Account: &ServiceFixtureWebdavDummy,
RemoteDate: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
RemoteSize: int64(860),
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
},
}
// CreateFileSyncFixtures inserts known entities into the database for testing.
func CreateFileSyncFixtures() {
for _, entity := range FileSyncFixtures {
Db().Create(&entity)
}
}