File: fixtures.go

package info (click to toggle)
golang-github-rackspace-gophercloud 1.0.0%2Bgit20161013.1012.e00690e8-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,148 kB
  • ctags: 6,414
  • sloc: sh: 16; makefile: 6
file content (102 lines) | stat: -rw-r--r-- 2,964 bytes parent folder | download | duplicates (2)
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
// +build fixtures

package datastores

import (
	"fmt"

	"github.com/rackspace/gophercloud"
)

const version1JSON = `
{
	"id": "b00000b0-00b0-0b00-00b0-000b000000bb",
	"links": [
		{
			"href": "https://10.240.28.38:8779/v1.0/1234/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb",
			"rel": "self"
		},
		{
			"href": "https://10.240.28.38:8779/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb",
			"rel": "bookmark"
		}
	],
	"name": "5.1"
}
`

const version2JSON = `
{
	"id": "c00000b0-00c0-0c00-00c0-000b000000cc",
	"links": [
		{
			"href": "https://10.240.28.38:8779/v1.0/1234/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc",
			"rel": "self"
		},
		{
			"href": "https://10.240.28.38:8779/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc",
			"rel": "bookmark"
		}
	],
	"name": "5.2"
}
`

var versionsJSON = fmt.Sprintf(`"versions": [%s, %s]`, version1JSON, version2JSON)

var singleDSJSON = fmt.Sprintf(`
{
  "default_version": "c00000b0-00c0-0c00-00c0-000b000000cc",
  "id": "10000000-0000-0000-0000-000000000001",
  "links": [
    {
      "href": "https://10.240.28.38:8779/v1.0/1234/datastores/10000000-0000-0000-0000-000000000001",
      "rel": "self"
    },
    {
      "href": "https://10.240.28.38:8779/datastores/10000000-0000-0000-0000-000000000001",
      "rel": "bookmark"
    }
  ],
  "name": "mysql",
  %s
}
`, versionsJSON)

var (
	ListDSResp       = fmt.Sprintf(`{"datastores":[%s]}`, singleDSJSON)
	GetDSResp        = fmt.Sprintf(`{"datastore":%s}`, singleDSJSON)
	ListVersionsResp = fmt.Sprintf(`{%s}`, versionsJSON)
	GetVersionResp   = fmt.Sprintf(`{"version":%s}`, version1JSON)
)

var ExampleVersion1 = Version{
	ID: "b00000b0-00b0-0b00-00b0-000b000000bb",
	Links: []gophercloud.Link{
		gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb"},
		gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb"},
	},
	Name: "5.1",
}

var exampleVersion2 = Version{
	ID: "c00000b0-00c0-0c00-00c0-000b000000cc",
	Links: []gophercloud.Link{
		gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc"},
		gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc"},
	},
	Name: "5.2",
}

var ExampleVersions = []Version{ExampleVersion1, exampleVersion2}

var ExampleDatastore = Datastore{
	DefaultVersion: "c00000b0-00c0-0c00-00c0-000b000000cc",
	ID:             "10000000-0000-0000-0000-000000000001",
	Links: []gophercloud.Link{
		gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/10000000-0000-0000-0000-000000000001"},
		gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/10000000-0000-0000-0000-000000000001"},
	},
	Name:     "mysql",
	Versions: ExampleVersions,
}