Exemplo n.º 1
0
func TestInstallAction(t *testing.T) {
	NewActions(nil)
	actionName := "mock"

	InstallAction(actionName, &MockAction{}, NewMockAction)

	a := repository.InstalledActions[actionName].NewFunc()

	assert.IsType(t, a, NewMockAction())
	ClearActions()
}
Exemplo n.º 2
0
func TestEnableActions(t *testing.T) {
	NewActions(nil)
	actionName := "mock"

	InstallAction(actionName, &MockAction{}, NewMockAction)
	EnableActions([]string{actionName})

	enabled := repository.EnabledActions[actionName]

	assert.IsType(t, enabled, NewMockAction())
	ClearActions()
}
Exemplo n.º 3
0
func TestNewActions(t *testing.T) {
	a := NewActions(nil)

	assert.IsType(t, a, &ActionRepository{})
	assert.Equal(t, a.EnabledActions, Actions())
	assert.Equal(t, a, repository)

	ClearActions()

	assert.Nil(t, repository.EnabledActions)
	assert.Nil(t, Actions())
}
Exemplo n.º 4
0
func TestRegisterAction(t *testing.T) {
	NewActions(nil)

	addr := &ActionAddress{
		NewFunc: NewMockAction,
	}

	RegisterAction(addr)

	registered := repository.EnabledActions["mock"]
	assert.IsType(t, registered, NewMockAction())

	ClearActions()
}