Exemple #1
0
			Eventually(sess).Should(Say("=== Users"))
			output := string(sess.Out.Contents())
			Expect(output).To(ContainSubstring(admin.Username))
			Expect(err).NotTo(HaveOccurred())
			Eventually(sess).Should(Exit(0))
		})

	})

	Context("with an existing non-admin user", func() {

		var user model.User

		BeforeEach(func() {
			user = auth.Register()
		})

		AfterEach(func() {
			auth.Cancel(user)
		})

		Specify("that user cannot list all users", func() {
			sess, err := cmd.Start("deis users:list", &user)
			Eventually(sess.Err, settings.MaxEventuallyTimeout).Should(Say(util.PrependError(deis.ErrForbidden)))
			Expect(err).NotTo(HaveOccurred())
			Eventually(sess).Should(Exit(1))
		})
	})

})
		BeforeEach(func() {
			user = auth.Register()
		})

		AfterEach(func() {
			auth.Cancel(user)
		})

		Context("and an app that does not exist", func() {

			bogusAppName := "bogus-app-name"

			Specify("that user cannot create a build for that app", func() {
				sess, err := cmd.Start("deis builds:create -a %s %s", &user, bogusAppName, builds.ExampleImage)
				Eventually(sess.Err).Should(Say(util.PrependError(deis.ErrNotFound)))
				Expect(err).NotTo(HaveOccurred())
				Eventually(sess).Should(Exit(1))
			})

		})

		Context("who owns an existing app that has not been deployed", func() {

			var app model.App

			BeforeEach(func() {
				app = apps.Create(user, "--no-remote")
				configs.Set(user, app, "DEIS_KUBERNETES_DEPLOYMENTS", "1")
			})
Exemple #3
0
		var user model.User

		BeforeEach(func() {
			user = auth.Register()
		})

		AfterEach(func() {
			auth.Cancel(user)
		})

		Specify("that user cannot add a cert with a malformed name", func() {
			sess, err := cmd.Start("deis certs:add %s %s %s", &user, "bogus.cert.name", cert.CertPath, cert.KeyPath)
			// TODO: Figure out spacing issues that necessitate this workaround.
			output := sess.Wait().Err.Contents()
			Expect(strings.TrimSpace(string(output))).To(Equal(util.PrependError(deis.ErrInvalidName)))
			Expect(err).NotTo(HaveOccurred())
			Eventually(sess).Should(Exit(1))
		})

		Specify("that user cannot add a cert using a non-existent cert file", func() {
			nonExistentCertFile := "non.existent.cert"
			sess, err := cmd.Start("deis certs:add %s %s %s", &user, cert.Name, nonExistentCertFile, cert.KeyPath)
			Eventually(sess.Err).Should(Say("open %s: no such file or directory", nonExistentCertFile))
			Expect(err).NotTo(HaveOccurred())
			Eventually(sess).Should(Exit(1))
		})

		Specify("that user cannot add a cert using a non-existent key file", func() {
			nonExistentKeyFile := "non.existent.key"
			sess, err := cmd.Start("deis certs:add %s %s %s", &user, cert.Name, cert.CertPath, nonExistentKeyFile)
Exemple #4
0
				Expect(err).NotTo(HaveOccurred())
				Eventually(sess).Should(Exit(0))
			})

			Specify("that user can add domains to that app", func() {
				domain := getRandDomain()
				sess, err := cmd.Start("deis domains:add %s --app=%s", &user, domain, app.Name)
				Eventually(sess).Should(Say("Adding %s to %s...", domain, app.Name))
				Eventually(sess, settings.MaxEventuallyTimeout).Should(Say("done"))
				Expect(err).NotTo(HaveOccurred())
				Eventually(sess).Should(Exit(0))
			})

			Specify("that user cannot remove a non-existent domain from that app", func() {
				sess, err := cmd.Start("deis domains:remove --app=%s %s", &user, app.Name, "non.existent.domain")
				Eventually(sess.Err, settings.MaxEventuallyTimeout).Should(Say(util.PrependError(deis.ErrNotFound)))
				Expect(err).NotTo(HaveOccurred())
				Eventually(sess).Should(Exit(1))
			})

			Context("with a domain added to it", func() {

				var domain string

				BeforeEach(func() {
					domain = getRandDomain()
					domains.Add(user, app, domain)
				})

				Specify("that user can remove that domain from that app", func() {
					sess, err := cmd.Start("deis domains:remove %s --app=%s", &user, domain, app.Name)