Пример #1
0
func authPasswdTest(t *testing.T, params *utils.DeisTestConfig) {
	password := "******"
	params.NewPassword = password
	cmd := authPasswdCmd
	utils.Execute(t, cmd, params, false, "")
	params.Password = "******"
	utils.Execute(t, cmd, params, true, "Password change failed")

	cmd = authLoginCmd
	utils.Execute(t, cmd, params, true, "400 BAD REQUEST")
	params.Password = password
	utils.Execute(t, cmd, params, false, "")
}
Пример #2
0
// buildsCreateTest uses the `deis builds:create` (or `deis pull`) command
// to promote a build from an existing docker image.
func buildsCreateTest(t *testing.T, params *utils.DeisTestConfig) {
	params.AppName = "deispullsample"
	params.ImageID = "deis/example-go:latest"
	params.ExampleApp = "example-deis-pull"
	if err := os.Mkdir(params.ExampleApp, 0755); err != nil {
		t.Fatal(err)
	}
	if err := utils.Chdir(params.ExampleApp); err != nil {
		t.Fatal(err)
	}
	utils.Execute(t, appsCreateCmdNoRemote, params, false, "")
	utils.Execute(t, buildsCreateCmd, params, false, "")
	if err := utils.Chdir(".."); err != nil {
		t.Fatal(err)
	}
}
Пример #3
0
func authPasswdTest(t *testing.T, params *utils.DeisTestConfig) {
	password := "******"
	utils.AuthPasswd(t, params, password)
	cmd := authLoginCmd
	utils.Execute(t, cmd, params, true, "400 BAD REQUEST")
	params.Password = password
	utils.Execute(t, cmd, params, false, "")
}
Пример #4
0
func appsTransferTest(t *testing.T, params *utils.DeisTestConfig) {
	user := utils.GetGlobalConfig()
	user.UserName, user.Password = "******", "test"
	user.AppName = "transfer-test"
	user.NewOwner = params.UserName
	utils.Execute(t, authRegisterCmd, user, false, "")
	utils.Execute(t, authLoginCmd, user, false, "")
	utils.Execute(t, appsCreateCmdNoRemote, user, false, "")
	utils.Execute(t, appsTransferCmd, user, false, "")
	utils.Execute(t, appsInfoCmd, user, true, "403 FORBIDDEN")
	utils.Execute(t, authLoginCmd, params, false, "")
	params.AppName = user.AppName
	utils.CheckList(t, appsInfoCmd, params, params.UserName, false)
}
Пример #5
0
func buildsListTest(t *testing.T, params *utils.DeisTestConfig) {
	cmd := buildsListCmd
	var cmdBuf bytes.Buffer
	tmpl := template.Must(template.New("cmd").Parse(cmd))
	if err := tmpl.Execute(&cmdBuf, params); err != nil {
		t.Fatal(err)
	}
	cmdString := cmdBuf.String()
	cmdl := exec.Command("sh", "-c", utils.Deis+cmdString)
	stdout, _, err := utils.RunCommandWithStdoutStderr(cmdl)
	if err != nil {
		t.Fatal(err)
	}
	ImageID := strings.Split(stdout.String(), "\n")[2]
	params.ImageID = strings.Fields(ImageID)[0]
}
Пример #6
0
func keysAddTest(t *testing.T, params *utils.DeisTestConfig) {
	params.AuthKey = "deiskey"
	utils.Execute(t, keysAddCmd, params, false, "")
	utils.Execute(t, keysAddCmd, params, true,
		"This field must be unique")
}
Пример #7
0
func keysAddTest(t *testing.T, params *utils.DeisTestConfig) {
	params.AuthKey = "deiskey"
	utils.Execute(t, keysAddCmd, params, false, "")
	utils.Execute(t, keysAddCmd, params, true,
		"SSH Key with this Public already exists")
}