func (fp *FakePersistor) Load(data configuration.DataInterface) error {
	if fp.LoadReturns.Data == nil {
		fp.LoadReturns.Data = coreconfig.NewData()
	}
	return fp.LoadReturns.Err
}
Beispiel #2
0
						Name: "repo1",
						URL:  "http://repo.com",
					},
				},
			}

			jsonData, err := data.JSONMarshalV3()
			Expect(err).NotTo(HaveOccurred())

			Expect(jsonData).To(MatchJSON(exampleV3JSON))
		})
	})

	Describe("JSONUnmarshalV3", func() {
		It("returns an error when the JSON is invalid", func() {
			configData := coreconfig.NewData()
			err := configData.JSONUnmarshalV3([]byte(`{ "not_valid": ### }`))
			Expect(err).To(HaveOccurred())
		})

		It("creates a config object from valid V3 JSON", func() {
			expectedData := &coreconfig.Data{
				ConfigVersion:            3,
				Target:                   "api.example.com",
				APIVersion:               "3",
				AuthorizationEndpoint:    "auth.example.com",
				LoggregatorEndPoint:      "loggregator.example.com",
				RoutingAPIEndpoint:       "routing-api.example.com",
				DopplerEndPoint:          "doppler.example.com",
				UaaEndpoint:              "uaa.example.com",
				AccessToken:              "the-access-token",