testfixtures

package
v0.0.0-...-01b7c57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const V3OrgGuid = "13200e2e-cb27-4c3e-b9fe-393d20370677"
View Source
const V3OrgName = "an-org"
View Source
const V3ServiceInstanceAlternateGuid = "0f52de7f-b7f6-435c-9f9d-f0bca1a6f874"
View Source
const V3ServiceInstanceGuid = "e9aca2a7-f4f9-431e-924c-664ddc236604"
View Source
const V3ServiceInstanceName = "a-service-instance"
View Source
const V3ServiceOfferingGuid = "38c435ac-87a5-4c19-9794-1ab3e99bd97c"
View Source
const V3ServiceOfferingName = "a-service-offering"
View Source
const V3ServicePlanAlternateGuid = "8a138e97-42d6-46f6-be0f-5347d23b7e8e"
View Source
const V3ServicePlanGuid = "2b5fa5bf-eafa-4ae3-9727-e1f6bcc622ee"
View Source
const V3SpaceGuid = "7ea72c2f-d0f1-4f4a-987e-7993807ab188"
View Source
const V3SpaceName = "a-space"

Variables

View Source
var V2Info = `` /* 624-byte string literal not displayed */
View Source
var V3Info = `` /* 354-byte string literal not displayed */
View Source
var V3Org = fmt.Sprintf(`
{
	"guid": "%[1]s",
	"created_at": "2017-02-01T01:33:58Z",
	"updated_at": "2017-02-01T01:33:58Z",
	"name": "%[2]s",
	"suspended": false,
	"relationships": {
	  "quota": {
		"data": {
		  "guid": "b7887f5c-34bb-40c5-9778-577572e4fb2d"
		}
	  }
	},
	"links": {
	  "self": {
		"href": "https://api.example.org/v3/organizations/%[1]s"
	  },
	  "domains": {
		"href": "https://api.example.org/v3/organizations/%[1]s/domains"
	  },
	  "default_domain": {
		"href": "https://api.example.org/v3/organizations/%[1]s/domains/default"
	  },
	  "quota": {
		"href": "https://api.example.org/v3/organization_quotas/%[1]s"
	  }
	},
	"metadata": {
	  "labels": {},
	  "annotations": {}
	}
  }
`,
	V3OrgGuid,
	V3OrgName)
View Source
var V3OrgPath = fmt.Sprintf("/v3/organizations/%s", V3OrgGuid)
View Source
var V3ServiceInstanceByNameListingPath = fmt.Sprintf("/v3/service_instances?names=%s", V3ServiceInstanceName)
View Source
var V3ServiceInstancePath = fmt.Sprintf("/v3/service_instances/%s", V3ServiceInstanceGuid)
View Source
var V3ServiceInstanceWithOrgAndSpaceNamePath = fmt.Sprintf("/v3/service_instances/%s?fields[space]=name&fields[space.organization]=name", V3ServiceInstanceGuid)
View Source
var V3ServiceInstancesByMultiplePlanListing = fmt.Sprintf(`
{
	"pagination": {
	  "total_results": 1,
	  "total_pages": 1,
	  "first": {
		"href": "https://api.example.org/v3/service_instances?page=1&per_page=50&service_plan_guids=%[3]s,%[4]s"
	  },
	  "last": {
		"href": "https://api.example.org/v3/service_instances?page=1&per_page=50&service_plan_guids=%[3]s,%[4]s"
	  },
	  "next": null,
	  "previous": null
	},
	"resources": [
	  %[1]s,
	  %[2]s
	]
  }
`,
	V3ServiceInstance,
	NewV3ServiceInstance(V3ServiceInstanceAlternateGuid, "b-service-instance", V3SpaceGuid, V3ServicePlanAlternateGuid),
	V3ServicePlanGuid,
	V3ServicePlanAlternateGuid)
View Source
var V3ServiceInstancesByMultiplePlanListingPath = fmt.Sprintf("/v3/service_instances?per_page=5000&service_plan_guids=%s,%s", V3ServicePlanGuid, V3ServicePlanAlternateGuid)
View Source
var V3ServiceInstancesByNameListing = fmt.Sprintf(`
{
  "pagination": {
    "total_results": 1,
    "total_pages": 1,
    "first": {
      "href": "https://api.example.org/v3/service_instances?page=1&per_page=5000&names=%[2]s"
    },
    "last": {
      "href": "https://api.example.org/v3/service_instances?page=1&per_page=5000&names=%[2]s"
    },
    "next": null,
    "previous": null
  },
  "resources": [
	%[1]s
  ]
}
`,
	V3ServiceInstance,
	V3ServiceInstanceName)
View Source
var V3ServiceInstancesBySinglePlanListing = fmt.Sprintf(`
{
	"pagination": {
	  "total_results": 1,
	  "total_pages": 1,
	  "first": {
		"href": "https://api.example.org/v3/service_instances?page=1&per_page=50&service_plan_guids=%[3]s"
	  },
	  "last": {
		"href": "https://api.example.org/v3/service_instances?page=1&per_page=50&service_plan_guids=%[3]s"
	  },
	  "next": null,
	  "previous": null
	},
	"resources": [
	  %[1]s,
	  %[2]s
	]
  }
`,
	V3ServiceInstance,
	NewV3ServiceInstance(V3ServiceInstanceAlternateGuid, "b-service-instance", V3SpaceGuid, V3ServicePlanGuid),
	V3ServicePlanGuid)
View Source
var V3ServiceInstancesBySinglePlanListingPath = fmt.Sprintf("/v3/service_instances?per_page=5000&service_plan_guids=%s", V3ServicePlanGuid)
View Source
var V3ServiceOffering = fmt.Sprintf(`
{
  "guid": "%[1]s",
  "name": "%[2]s",
  "description": "Provides my service",
  "available": true,
  "tags": ["relational", "caching"],
  "requires": [],
  "created_at": "2019-11-28T13:44:02Z",
  "updated_at": "2019-11-28T13:44:02Z",
  "shareable": true,
  "documentation_url": "https://some-documentation-link.io",
  "broker_catalog": {
    "id": "db730a8c-11e5-11ea-838a-0f4fff3b1cfb",
    "metadata": {
      "shareable": true
    },
    "features": {
      "plan_updateable": true,
      "bindable": true,
      "instances_retrievable": true,
      "bindings_retrievable": true,
      "allow_context_updates": false
    }
  },
  "relationships": {
    "service_broker": {
      "data": {
        "guid": "13c60e38-11e7-11ea-9106-33ee3c5bd4d7"
      }
    }
  },
  "metadata": {
    "labels": {},
    "annotations": {}
  },
  "links": {
    "self": {
      "href": "https://api.example.org/v3/service_offerings/%[1]s"
    },
    "service_plans": {
      "href": "https://api.example.org/v3/service_plans?service_offering_guids=%[1]s"
    },
    "service_broker": {
      "href": "https://api.example.org/v3/service_brokers/13c60e38-11e7-11ea-9106-33ee3c5bd4d7"
    }
  }
}
`,
	V3ServiceOfferingGuid,
	V3ServiceOfferingName)
View Source
var V3ServiceOfferingByNameListing = fmt.Sprintf(`
{
  "pagination": {
    "total_results": 1,
    "total_pages": 1,
    "first": {
      "href": "https://api.example.org/v3/service_offerings?page=1&per_page=1&names=%[2]s"
    },
    "last": {
      "href": "https://api.example.org/v3/service_offerings?page=1&per_page=1&names=%[2]s"
    },
    "next": null,
    "previous": null
  },
  "resources": [
	%[1]s
  ]
}
`,
	V3ServiceOffering,
	V3ServiceOfferingName)
View Source
var V3ServiceOfferingByNamePath = fmt.Sprintf("/v3/service_offerings?names=%s", V3ServiceOfferingName)
View Source
var V3ServiceOfferingPath = fmt.Sprintf("/v3/service_offerings/%s", V3ServiceOfferingGuid)
View Source
var V3ServicePlanPath = fmt.Sprintf("/v3/service_plans/%s", V3ServicePlanGuid)
View Source
var V3ServicePlansForOfferingListing = fmt.Sprintf(`
{
  "pagination": {
    "total_results": 2,
    "total_pages": 1,
    "first": {
      "href": "https://api.example.org/v3/service_plans?page=1&per_page=5000&service_offering_guids=%[1]s"
    },
    "last": {
      "href": "https://api.example.org/v3/service_plans?page=2&per_page=5000&service_offering_guids=%[1]s"
    },
    "next": null,
    "previous": null
  },
  "resources": [
	%[2]s,
	%[3]s
  ]
}`,
	V3ServiceOfferingGuid,
	V3ServicePlan,
	NewV3ServicePlan(V3ServicePlanAlternateGuid, V3ServiceOfferingGuid),
)
View Source
var V3ServicePlansForOfferingPath = fmt.Sprintf("/v3/service_plans?per_page=5000&service_offering_guids=%s", V3ServiceOfferingGuid)
View Source
var V3Space = fmt.Sprintf(`
{
	"guid": "%[1]s",
	"created_at": "2017-02-01T01:33:58Z",
	"updated_at": "2017-02-01T01:33:58Z",
	"name": "%[3]s",
	"relationships": {
	  "organization": {
		"data": {
		  "guid": "%[2]s"
		}
	  },
	  "quota": {
		"data": null
	  }
	},
	"links": {
	  "self": {
		"href": "https://api.example.org/v3/spaces/%[1]s"
	  },
	  "features": {
		"href": "https://api.example.org/v3/spaces/%[1]s/features"
	  },
	  "organization": {
		"href": "https://api.example.org/v3/organizations/%[2]s"
	  },
	  "apply_manifest": {
		"href": "https://api.example.org/v3/spaces/%[1]s/actions/apply_manifest",
		"method": "POST"
	  }
	},
	"metadata": {
	  "labels": {},
	  "annotations": {}
	}
  }
`,
	V3SpaceGuid,
	V3OrgGuid,
	V3SpaceName,
)
View Source
var V3SpacePath = fmt.Sprintf("/v3/spaces/%s", V3SpaceGuid)

Functions

func ConfigureAPIServer

func ConfigureAPIServer(apiServer *APIServer)

Configures the API server to serve the different responses at different paths

func NewTestCLIConnection

func NewTestCLIConnection(apiAddr string) plugin.CliConnection

func NewV3ServiceInstance

func NewV3ServiceInstance(instanceGuid string, instanceName string, spaceGuid string, servicePlanGuid string) string

func NewV3ServiceInstanceWithOrgAndSpaceName

func NewV3ServiceInstanceWithOrgAndSpaceName(
	instanceGuid string,
	instanceName string,
	spaceGuid string,
	servicePlanGuid string,
	orgName string,
	spaceName string,
) string

func NewV3ServicePlan

func NewV3ServicePlan(planGuid string, offeringGuid string) string

Types

type APIServer

type APIServer struct {
	// contains filtered or unexported fields
}

func NewAPIServer

func NewAPIServer() *APIServer

func (*APIServer) ListenerAddr

func (api *APIServer) ListenerAddr() string

func (*APIServer) PathReturns

func (api *APIServer) PathReturns(path string, bytes []byte)

func (*APIServer) Stop

func (api *APIServer) Stop()

type TestCLIConnection

type TestCLIConnection struct {
	// contains filtered or unexported fields
}

func (*TestCLIConnection) AccessToken

func (cli *TestCLIConnection) AccessToken() (string, error)

func (*TestCLIConnection) ApiEndpoint

func (cli *TestCLIConnection) ApiEndpoint() (string, error)

func (*TestCLIConnection) ApiVersion

func (cli *TestCLIConnection) ApiVersion() (string, error)

func (*TestCLIConnection) CliCommand

func (cli *TestCLIConnection) CliCommand(args ...string) ([]string, error)

func (*TestCLIConnection) CliCommandWithoutTerminalOutput

func (cli *TestCLIConnection) CliCommandWithoutTerminalOutput(args ...string) ([]string, error)

func (*TestCLIConnection) DopplerEndpoint

func (cli *TestCLIConnection) DopplerEndpoint() (string, error)

func (*TestCLIConnection) GetApp

func (*TestCLIConnection) GetApps

func (cli *TestCLIConnection) GetApps() ([]plugin_models.GetAppsModel, error)

func (*TestCLIConnection) GetCurrentOrg

func (cli *TestCLIConnection) GetCurrentOrg() (plugin_models.Organization, error)

func (*TestCLIConnection) GetCurrentSpace

func (cli *TestCLIConnection) GetCurrentSpace() (plugin_models.Space, error)

func (*TestCLIConnection) GetOrg

func (*TestCLIConnection) GetOrgUsers

func (cli *TestCLIConnection) GetOrgUsers(_ string, _ ...string) ([]plugin_models.GetOrgUsers_Model, error)

func (*TestCLIConnection) GetOrgs

func (cli *TestCLIConnection) GetOrgs() ([]plugin_models.GetOrgs_Model, error)

func (*TestCLIConnection) GetService

func (*TestCLIConnection) GetServices

func (cli *TestCLIConnection) GetServices() ([]plugin_models.GetServices_Model, error)

func (*TestCLIConnection) GetSpace

func (*TestCLIConnection) GetSpaceUsers

func (cli *TestCLIConnection) GetSpaceUsers(_ string, _ string) ([]plugin_models.GetSpaceUsers_Model, error)

func (*TestCLIConnection) GetSpaces

func (cli *TestCLIConnection) GetSpaces() ([]plugin_models.GetSpaces_Model, error)

func (*TestCLIConnection) HasAPIEndpoint

func (cli *TestCLIConnection) HasAPIEndpoint() (bool, error)

func (*TestCLIConnection) HasOrganization

func (cli *TestCLIConnection) HasOrganization() (bool, error)

func (*TestCLIConnection) HasSpace

func (cli *TestCLIConnection) HasSpace() (bool, error)

func (*TestCLIConnection) IsLoggedIn

func (cli *TestCLIConnection) IsLoggedIn() (bool, error)

func (*TestCLIConnection) IsSSLDisabled

func (cli *TestCLIConnection) IsSSLDisabled() (bool, error)

IsSSLDisabled returns true if and only if the user is connected to the Cloud Controller API with the `--skip-ssl-validation` flag set unless the CLI configuration file cannot be read, in which case it returns an error.

func (*TestCLIConnection) LoggregatorEndpoint

func (cli *TestCLIConnection) LoggregatorEndpoint() (string, error)

func (*TestCLIConnection) UserEmail

func (cli *TestCLIConnection) UserEmail() (string, error)

func (*TestCLIConnection) UserGuid

func (cli *TestCLIConnection) UserGuid() (string, error)

func (*TestCLIConnection) Username

func (cli *TestCLIConnection) Username() (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL