jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 1 | package testing |
Jamie Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | |
Krzysztof Szukiełojć | 3f41d08 | 2017-05-07 14:43:06 +0200 | [diff] [blame^] | 6 | "gerrit.mcp.mirantis.net/debian/gophercloud.git" |
Krzysztof Szukiełojć | 24a29ce | 2017-05-07 14:24:02 +0200 | [diff] [blame] | 7 | "gerrit.mcp.mirantis.net/debian/gophercloud.git/openstack/db/v1/datastores" |
Jamie Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 8 | ) |
| 9 | |
| 10 | const 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 | |
| 27 | const 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 | |
| 44 | var versionsJSON = fmt.Sprintf(`"versions": [%s, %s]`, version1JSON, version2JSON) |
| 45 | |
| 46 | var 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 | |
| 65 | var ( |
| 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 | |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 72 | var ExampleVersion1 = datastores.Version{ |
Jamie Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 73 | ID: "b00000b0-00b0-0b00-00b0-000b000000bb", |
| 74 | Links: []gophercloud.Link{ |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 75 | {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 Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 77 | }, |
| 78 | Name: "5.1", |
| 79 | } |
| 80 | |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 81 | var exampleVersion2 = datastores.Version{ |
Jamie Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 82 | ID: "c00000b0-00c0-0c00-00c0-000b000000cc", |
| 83 | Links: []gophercloud.Link{ |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 84 | {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 Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 86 | }, |
| 87 | Name: "5.2", |
| 88 | } |
| 89 | |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 90 | var ExampleVersions = []datastores.Version{ExampleVersion1, exampleVersion2} |
Jamie Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 91 | |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 92 | var ExampleDatastore = datastores.Datastore{ |
Jamie Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 93 | DefaultVersion: "c00000b0-00c0-0c00-00c0-000b000000cc", |
| 94 | ID: "10000000-0000-0000-0000-000000000001", |
| 95 | Links: []gophercloud.Link{ |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 96 | {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 Hannaford | 52dbcee | 2015-10-06 16:09:56 +0200 | [diff] [blame] | 98 | }, |
| 99 | Name: "mysql", |
| 100 | Versions: ExampleVersions, |
| 101 | } |