blob: bd00a8eabfc27cb3806b8bd32d1e7b220cfe85f2 [file] [log] [blame]
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package clistate
import (
"testing"
"github.com/hashicorp/terraform/internal/command/arguments"
"github.com/hashicorp/terraform/internal/command/views"
"github.com/hashicorp/terraform/internal/states/statemgr"
"github.com/hashicorp/terraform/internal/terminal"
)
func TestUnlock(t *testing.T) {
streams, _ := terminal.StreamsForTesting(t)
view := views.NewView(streams)
l := NewLocker(0, views.NewStateLocker(arguments.ViewHuman, view))
l.Lock(statemgr.NewUnlockErrorFull(nil, nil), "test-lock")
diags := l.Unlock()
if diags.HasErrors() {
t.Log(diags.Err().Error())
} else {
t.Error("expected error")
}
}