コード例 #1
0
ファイル: actions_test.go プロジェクト: antonylewis/eris-cli
func TestListKnownActions(t *testing.T) {
	do := definitions.NowDo()
	do.Quiet = true
	tests.IfExit(list.ListActions(do))
	k := strings.Split(do.Result, "\n") // tests output formatting.

	ver.ACTION_DEFINITIONS = append(ver.ACTION_DEFINITIONS, "do_not_use.toml")

	if len(k) != len(ver.ACTION_DEFINITIONS) {
		tests.IfExit(fmt.Errorf("Did not find correct number of action definitions files, Expected %v, found %v.\n", len(ver.ACTION_DEFINITIONS), len(k)))
	}

	actDefs := make(map[string]bool)

	for _, act := range ver.ACTION_DEFINITIONS {
		actDef := strings.Split(act, ".")
		actDefs[actDef[0]] = true
	}

	i := 0
	for _, actFile := range k {
		if actDefs[actFile] == true {
			i++
		}
	}

	if i != len(ver.ACTION_DEFINITIONS) {
		tests.IfExit(fmt.Errorf("Could not find all the expected action definition files.\n"))
	}
}
コード例 #2
0
ファイル: clean_test.go プロジェクト: antonylewis/eris-cli
func TestMain(m *testing.M) {
	log.SetFormatter(logger.ErisFormatter{})

	log.SetLevel(log.ErrorLevel)
	// log.SetLevel(log.InfoLevel)
	// log.SetLevel(log.DebugLevel)
	tests.IfExit(testsInit())

	exitCode := m.Run()
	tests.IfExit(tests.TestsTearDown())
	os.Exit(exitCode)
}
コード例 #3
0
ファイル: files_test.go プロジェクト: antonylewis/eris-cli
func TestMain(m *testing.M) {
	log.SetFormatter(logger.ErisFormatter{})

	log.SetLevel(log.ErrorLevel)
	// log.SetLevel(log.InfoLevel)
	// log.SetLevel(log.DebugLevel)

	// Prevent CLI from starting IPFS.
	os.Setenv("ERIS_SKIP_ENSURE", "true")

	tests.IfExit(testsInit())
	exitCode := m.Run()
	tests.IfExit(tests.TestsTearDown())
	os.Exit(exitCode)
}
コード例 #4
0
ファイル: chains_test.go プロジェクト: antonylewis/eris-cli
func TestMain(m *testing.M) {
	runtime.GOMAXPROCS(1)
	log.SetFormatter(logger.ErisFormatter{})

	log.SetLevel(log.ErrorLevel)
	// log.SetLevel(log.InfoLevel)
	// log.SetLevel(log.DebugLevel)

	tests.IfExit(tests.TestsInit("chain"))
	mockChainDefinitionFile(chainName)

	m.Run()

	tests.IfExit(tests.TestsTearDown())
}
コード例 #5
0
ファイル: keys_test.go プロジェクト: antonylewis/eris-cli
//returns an addr for tests
func testsGenAKey() string {
	addr := new(bytes.Buffer)
	config.GlobalConfig.Writer = addr
	doGen := def.NowDo()
	tests.IfExit(GenerateKey(doGen))

	addrBytes := addr.Bytes()
	address := util.TrimString(string(addrBytes))
	return address
}
コード例 #6
0
ファイル: keys_test.go プロジェクト: antonylewis/eris-cli
func testListKeys(typ string) []string {
	do := def.NowDo()

	if typ == "container" {
		do.Container = true
		do.Host = false
	} else if typ == "host" {
		do.Container = false
		do.Host = true
	}

	if err := ListKeys(do); err != nil {
		tests.IfExit(err)
	}

	res := strings.Split(do.Result, ",")

	return res
}