Matt Farina 7eef44f0c8 Adding examples that can optionally be used as acceptance tests.
Change-Id: Ie13680476865ece878a1c3486bbc3fd61c0d41b9
2014-05-22 10:01:03 -04:00

33 lines
808 B
Go

// The acceptance package is a set of acceptance tests showcasing how the
// contents of the package are meant to be used. This is setup in a similar
// manner to a consuming application.
package main
import (
"encoding/json"
"io/ioutil"
)
// testconfig contains the user information needed by the acceptance and
// integration tests.
type testconfig struct {
Host string
Username string
Password string
ProjectID string
ProjectName string
}
// getConfig provides access to credentials in other tests and examples.
func getConfig() *testconfig {
config := &testconfig{}
userJSON, err := ioutil.ReadFile("config.json")
if err != nil {
panic("ReadFile json failed")
}
if err = json.Unmarshal(userJSON, &config); err != nil {
panic("Unmarshal json failed")
}
return config
}