Beispiel #1
0
func TestAssociated(t *testing.T) {
	if err := test.SetUpGitRepo(); err != nil {
		t.Error(err)
		t.Fail()
	}
	for _, data := range associatedTests {
		t.Logf("Data: %+v", data)
		if err := test.ClearAssociations(); err != nil {
			t.Error(err)
			continue
		}
		if data.associateFirst {
			if err := test.SetUpAssociation(); err != nil {
				t.Error(err)
				continue
			}
		}
		r := regexp.MustCompile(data.expectedOutput)
		output, err := test.RunCommand(test.BinaryName, []string{commandName})
		if err != nil != data.expectErr {
			t.Errorf("Unexpected error: %s", output)
			continue
		}
		if !r.MatchString(output) {
			t.Errorf("Expected: %s. Found: %s", data.expectedOutput, output)
			continue
		}
	}
}
Beispiel #2
0
func TestCertsRmNoAssociation(t *testing.T) {
	if err := test.ClearAssociations(); err != nil {
		t.Error(err)
		return
	}
	output, err := test.RunCommand(test.BinaryName, []string{certsRmCommandName, certsRmSubcommandName, certName})
	if err == nil {
		t.Errorf("Expected error but no error returned: %s", output)
		return
	}
	expectedOutput := "\033[31m\033[1m[fatal] \033[0mNo Catalyze environment has been associated. Run \"catalyze associate\" from a local git repo first\n"
	if output != expectedOutput {
		t.Errorf("Expected: %s. Found: %s", expectedOutput, output)
		return
	}
}
Beispiel #3
0
func TestClearNoAssociation(t *testing.T) {
	if err := test.ClearAssociations(); err != nil {
		t.Error(err)
		return
	}
	output, err := test.RunCommand(test.BinaryName, []string{commandName, "--all"})
	if err != nil {
		t.Errorf("Unexpected error : %s - %s", err, output)
		return
	}
	expectedOutput := "\033[33m\033[1m[warning] \033[0mThe \"--default\" flag has been deprecated! It will be removed in a future version.\n" + standardOutput
	if output != expectedOutput {
		t.Errorf("Expected: %s. Found: %s", expectedOutput, output)
		return
	}
}