Esempio n. 1
0
var _ = Describe("Rest Workloads", func() {
	var (
		client            *dummyClient
		rest              workloads
		args              []string
		replies           map[string]interface{}
		replyWithLocation map[string]string
		context           map[string]interface{}
	)

	BeforeEach(func() {
		replies = make(map[string]interface{})
		replyWithLocation = make(map[string]string)
		client = &dummyClient{replies, replyWithLocation, make(map[call]interface{})}
		rest = NewRestWorkloadWithClient(client)
		config := config.NewConfig()
		rest.DescribeParameters(config)
		config.Parse(args)
		args = []string{"-rest:target", "APISERVER"}
		context = make(map[string]interface{})

		replies["APISERVER/v2/info"] = TargetResponse{"THELOGINSERVER/PATH"}
	})

	Describe("Pushing an app", func() {
		Context("When the user has not logged in", func() {
			It("Returns an error", func() {
				err := rest.Push(context)
				Ω(err).Should(HaveOccurred())
			})
		})
Esempio n. 2
0
)

var _ = Describe("Config", func() {
	var (
		csvStoreDir   string
		csvStore      laboratory.Store
		redisHost     string
		redisPort     int
		redisPassword string
		redisStore    laboratory.Store
		flags         config.Config
		args          []string
	)

	BeforeEach(func() {
		flags = config.NewConfig()
		DescribeParameters(flags)
		args = []string{}
		csvStore = NewCsvStore("/tmp/fakecsvstore")
		redisStore = NewCsvStore("/tmp/fakeredisstore")
		CsvStoreFactory = func(dir string) laboratory.Store {
			csvStoreDir = dir
			return csvStore
		}
		RedisStoreFactory = func(host string, port int, password string) (laboratory.Store, error) {
			redisHost = host
			redisPort = port
			redisPassword = password
			return redisStore, nil
		}
	})