forked from G-Core/gcorelabscloud-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixtures.go
117 lines (105 loc) · 2.77 KB
/
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package testing
import (
"time"
"github.com/alexandrpaliy/gcorelabscloud-go/gcore/snapshot/v1/snapshots"
fake "github.com/alexandrpaliy/gcorelabscloud-go/testhelper/client"
gcorecloud "github.com/alexandrpaliy/gcorelabscloud-go"
"github.com/alexandrpaliy/gcorelabscloud-go/gcore/task/v1/tasks"
)
const ListResponse = `
{
"count": 1,
"results": [
{
"id": "726ecfcc-7fd0-4e30-a86e-7892524aa483",
"name": "123",
"status": "available",
"description": "mysnapshot",
"created_at": "2019-05-29T05:32:41+0000",
"updated_at": "2019-05-29T05:39:20+0000",
"size": 2,
"creator_task_id": "2358e3b1-5c42-4705-8950-6ddcfc19c3bd",
"volume_id": "67baa7d1-08ea-4fc5-bef2-6b2465b7d227",
"project_id": 1,
"region_id": 1,
"region": "RegionOne"
}
]
}
`
const GetResponse = `
{
"id": "726ecfcc-7fd0-4e30-a86e-7892524aa483",
"name": "123",
"status": "available",
"description": "mysnapshot",
"created_at": "2019-05-29T05:32:41+0000",
"updated_at": "2019-05-29T05:39:20+0000",
"size": 2,
"creator_task_id": "2358e3b1-5c42-4705-8950-6ddcfc19c3bd",
"volume_id": "67baa7d1-08ea-4fc5-bef2-6b2465b7d227",
"project_id": 1,
"region_id": 1,
"region": "RegionOne"
}
`
const CreateRequest = `
{
"volume_id": "67baa7d1-08ea-4fc5-bef2-6b2465b7d227",
"name": "123",
"description": "after boot",
"metadata": {
"key": "value"
}
}
`
const CreateResponse = `
{
"tasks": [
"50f53a35-42ed-40c4-82b2-5a37fb3e00bc"
]
}
`
const DeleteResponse = `
{
"tasks": [
"50f53a35-42ed-40c4-82b2-5a37fb3e00bc"
]
}
`
const MetadataCreateRequest = `
{
"test1": "test1",
"test2": "test2"
}
`
var (
createdTimeString = "2019-05-29T05:32:41+0000"
updatedTimeString = "2019-05-29T05:39:20+0000"
createdTimeParsed, _ = time.Parse(gcorecloud.RFC3339Z, createdTimeString)
createdTime = gcorecloud.JSONRFC3339Z{Time: createdTimeParsed}
updatedTimeParsed, _ = time.Parse(gcorecloud.RFC3339Z, updatedTimeString)
updatedTime = gcorecloud.JSONRFC3339Z{Time: updatedTimeParsed}
creatorTaskID = "2358e3b1-5c42-4705-8950-6ddcfc19c3bd"
volumeID = "67baa7d1-08ea-4fc5-bef2-6b2465b7d227"
Snapshot1 = snapshots.Snapshot{
ID: "726ecfcc-7fd0-4e30-a86e-7892524aa483",
Name: "123",
Description: "mysnapshot",
Status: "available",
Size: 2,
VolumeID: volumeID,
CreatedAt: createdTime,
UpdatedAt: &updatedTime,
Metadata: nil,
CreatorTaskID: &creatorTaskID,
TaskID: nil,
ProjectID: fake.ProjectID,
RegionID: fake.RegionID,
Region: "RegionOne",
}
Tasks1 = tasks.TaskResults{
Tasks: []tasks.TaskID{"50f53a35-42ed-40c4-82b2-5a37fb3e00bc"},
}
ExpectedSnapshotSlice = []snapshots.Snapshot{Snapshot1}
)