-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
128 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cmd | ||
|
||
import ( | ||
"bytes" | ||
"io" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAboutCmd(t *testing.T) { | ||
// Capture stdout since utils.PrintfMarkdown writes directly to os.Stdout | ||
oldStdout := os.Stdout | ||
r, w, _ := os.Pipe() | ||
os.Stdout = w | ||
|
||
// Execute the command | ||
err := aboutCmd.RunE(aboutCmd, []string{}) | ||
assert.NoError(t, err, "'atmos about' command should execute without error") | ||
|
||
// Close the writer and restore stdout | ||
err = w.Close() | ||
assert.NoError(t, err, "'atmos about' command should execute without error") | ||
|
||
os.Stdout = oldStdout | ||
|
||
// Read captured output | ||
var output bytes.Buffer | ||
_, err = io.Copy(&output, r) | ||
assert.NoError(t, err, "'atmos about' command should execute without error") | ||
|
||
// Check if output contains expected markdown content | ||
assert.Contains(t, output.String(), aboutMarkdown, "'atmos about' output should contain information about Atmos") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cmd | ||
|
||
import ( | ||
"bytes" | ||
"io" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestSupportCmd(t *testing.T) { | ||
// Capture stdout since utils.PrintfMarkdown writes directly to os.Stdout | ||
oldStdout := os.Stdout | ||
r, w, _ := os.Pipe() | ||
os.Stdout = w | ||
|
||
// Execute the command | ||
err := supportCmd.RunE(aboutCmd, []string{}) | ||
assert.NoError(t, err, "'atmos support' command should execute without error") | ||
|
||
// Close the writer and restore stdout | ||
err = w.Close() | ||
assert.NoError(t, err, "'atmos support' command should execute without error") | ||
|
||
os.Stdout = oldStdout | ||
|
||
// Read captured output | ||
var output bytes.Buffer | ||
_, err = io.Copy(&output, r) | ||
assert.NoError(t, err, "'atmos support' command should execute without error") | ||
|
||
// Check if output contains expected markdown content | ||
assert.Contains(t, output.String(), supportMarkdown, "'atmos support' output should contain information about Cloud Posse Atmos support") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters