blob: 88f727f795ec4cfb80284286b454676b7834b9ef [file] [log] [blame]
jrperritt3d966162016-06-06 14:08:54 -05001package testing
Jamie Hannaford52dbcee2015-10-06 16:09:56 +02002
3import (
4 "fmt"
5
Jon Perritt27249f42016-02-18 10:35:59 -06006 "github.com/gophercloud/gophercloud"
Krzysztof Szukiełojć24a29ce2017-05-07 14:24:02 +02007 "gerrit.mcp.mirantis.net/debian/gophercloud.git/openstack/db/v1/datastores"
Jamie Hannaford52dbcee2015-10-06 16:09:56 +02008)
9
10const version1JSON = `
11{
12 "id": "b00000b0-00b0-0b00-00b0-000b000000bb",
13 "links": [
14 {
15 "href": "https://10.240.28.38:8779/v1.0/1234/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb",
16 "rel": "self"
17 },
18 {
19 "href": "https://10.240.28.38:8779/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb",
20 "rel": "bookmark"
21 }
22 ],
23 "name": "5.1"
24}
25`
26
27const version2JSON = `
28{
29 "id": "c00000b0-00c0-0c00-00c0-000b000000cc",
30 "links": [
31 {
32 "href": "https://10.240.28.38:8779/v1.0/1234/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc",
33 "rel": "self"
34 },
35 {
36 "href": "https://10.240.28.38:8779/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc",
37 "rel": "bookmark"
38 }
39 ],
40 "name": "5.2"
41}
42`
43
44var versionsJSON = fmt.Sprintf(`"versions": [%s, %s]`, version1JSON, version2JSON)
45
46var singleDSJSON = fmt.Sprintf(`
47{
48 "default_version": "c00000b0-00c0-0c00-00c0-000b000000cc",
49 "id": "10000000-0000-0000-0000-000000000001",
50 "links": [
51 {
52 "href": "https://10.240.28.38:8779/v1.0/1234/datastores/10000000-0000-0000-0000-000000000001",
53 "rel": "self"
54 },
55 {
56 "href": "https://10.240.28.38:8779/datastores/10000000-0000-0000-0000-000000000001",
57 "rel": "bookmark"
58 }
59 ],
60 "name": "mysql",
61 %s
62}
63`, versionsJSON)
64
65var (
66 ListDSResp = fmt.Sprintf(`{"datastores":[%s]}`, singleDSJSON)
67 GetDSResp = fmt.Sprintf(`{"datastore":%s}`, singleDSJSON)
68 ListVersionsResp = fmt.Sprintf(`{%s}`, versionsJSON)
69 GetVersionResp = fmt.Sprintf(`{"version":%s}`, version1JSON)
70)
71
jrperritt3d966162016-06-06 14:08:54 -050072var ExampleVersion1 = datastores.Version{
Jamie Hannaford52dbcee2015-10-06 16:09:56 +020073 ID: "b00000b0-00b0-0b00-00b0-000b000000bb",
74 Links: []gophercloud.Link{
jrperritt3d966162016-06-06 14:08:54 -050075 {Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb"},
76 {Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb"},
Jamie Hannaford52dbcee2015-10-06 16:09:56 +020077 },
78 Name: "5.1",
79}
80
jrperritt3d966162016-06-06 14:08:54 -050081var exampleVersion2 = datastores.Version{
Jamie Hannaford52dbcee2015-10-06 16:09:56 +020082 ID: "c00000b0-00c0-0c00-00c0-000b000000cc",
83 Links: []gophercloud.Link{
jrperritt3d966162016-06-06 14:08:54 -050084 {Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc"},
85 {Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc"},
Jamie Hannaford52dbcee2015-10-06 16:09:56 +020086 },
87 Name: "5.2",
88}
89
jrperritt3d966162016-06-06 14:08:54 -050090var ExampleVersions = []datastores.Version{ExampleVersion1, exampleVersion2}
Jamie Hannaford52dbcee2015-10-06 16:09:56 +020091
jrperritt3d966162016-06-06 14:08:54 -050092var ExampleDatastore = datastores.Datastore{
Jamie Hannaford52dbcee2015-10-06 16:09:56 +020093 DefaultVersion: "c00000b0-00c0-0c00-00c0-000b000000cc",
94 ID: "10000000-0000-0000-0000-000000000001",
95 Links: []gophercloud.Link{
jrperritt3d966162016-06-06 14:08:54 -050096 {Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/10000000-0000-0000-0000-000000000001"},
97 {Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/10000000-0000-0000-0000-000000000001"},
Jamie Hannaford52dbcee2015-10-06 16:09:56 +020098 },
99 Name: "mysql",
100 Versions: ExampleVersions,
101}