mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 18:01:01 -06:00
68 lines
1.2 KiB
Go
68 lines
1.2 KiB
Go
|
package command
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/mitchellh/cli"
|
||
|
)
|
||
|
|
||
|
/*
|
||
|
func TestGet(t *testing.T) {
|
||
|
ui := new(cli.MockUi)
|
||
|
c := &GetCommand{
|
||
|
Meta: Meta{
|
||
|
ContextOpts: testCtxConfig(testProvider()),
|
||
|
Ui: ui,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
args := []string{
|
||
|
testFixturePath("get"),
|
||
|
}
|
||
|
if code := c.Run(args); code != 0 {
|
||
|
t.Fatalf("bad: \n%s", ui.ErrorWriter.String())
|
||
|
}
|
||
|
|
||
|
output := ui.OutputWriter.String()
|
||
|
if !strings.Contains(output, "Get: file://") {
|
||
|
t.Fatalf("doesn't look like get: %s", output)
|
||
|
}
|
||
|
if strings.Contains(output, "(update)") {
|
||
|
t.Fatalf("doesn't look like get: %s", output)
|
||
|
}
|
||
|
}
|
||
|
*/
|
||
|
|
||
|
func TestInit_multipleArgs(t *testing.T) {
|
||
|
ui := new(cli.MockUi)
|
||
|
c := &InitCommand{
|
||
|
Meta: Meta{
|
||
|
ContextOpts: testCtxConfig(testProvider()),
|
||
|
Ui: ui,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
args := []string{
|
||
|
"bad",
|
||
|
"bad",
|
||
|
}
|
||
|
if code := c.Run(args); code != 1 {
|
||
|
t.Fatalf("bad: \n%s", ui.OutputWriter.String())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestInit_noArgs(t *testing.T) {
|
||
|
ui := new(cli.MockUi)
|
||
|
c := &InitCommand{
|
||
|
Meta: Meta{
|
||
|
ContextOpts: testCtxConfig(testProvider()),
|
||
|
Ui: ui,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
args := []string{}
|
||
|
if code := c.Run(args); code != 1 {
|
||
|
t.Fatalf("bad: \n%s", ui.OutputWriter.String())
|
||
|
}
|
||
|
}
|