github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/db/v1/datastores/testing/fixtures.go (about)

     1  package testing
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/huaweicloud/golangsdk"
     7  	"github.com/huaweicloud/golangsdk/openstack/db/v1/datastores"
     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  
    72  var ExampleVersion1 = datastores.Version{
    73  	ID: "b00000b0-00b0-0b00-00b0-000b000000bb",
    74  	Links: []golangsdk.Link{
    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"},
    77  	},
    78  	Name: "5.1",
    79  }
    80  
    81  var exampleVersion2 = datastores.Version{
    82  	ID: "c00000b0-00c0-0c00-00c0-000b000000cc",
    83  	Links: []golangsdk.Link{
    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"},
    86  	},
    87  	Name: "5.2",
    88  }
    89  
    90  var ExampleVersions = []datastores.Version{ExampleVersion1, exampleVersion2}
    91  
    92  var ExampleDatastore = datastores.Datastore{
    93  	DefaultVersion: "c00000b0-00c0-0c00-00c0-000b000000cc",
    94  	ID:             "10000000-0000-0000-0000-000000000001",
    95  	Links: []golangsdk.Link{
    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"},
    98  	},
    99  	Name:     "mysql",
   100  	Versions: ExampleVersions,
   101  }