mirror of
https://github.com/onyx-and-iris/gobs-cli.git
synced 2025-05-20 16:10:26 +01:00
69 lines
1.6 KiB
Go
69 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestStudioModeEnable(t *testing.T) {
|
|
client, disconnect := getClient(t)
|
|
defer disconnect()
|
|
|
|
var out bytes.Buffer
|
|
context := &context{
|
|
Client: client,
|
|
Out: &out,
|
|
}
|
|
|
|
cmdEnable := &StudioModeEnableCmd{}
|
|
err := cmdEnable.Run(context)
|
|
if err != nil {
|
|
t.Fatalf("failed to enable studio mode: %v", err)
|
|
}
|
|
if out.String() != "Studio mode is now enabled\n" {
|
|
t.Fatalf("expected 'Studio mode is now enabled', got: %s", out.String())
|
|
}
|
|
// Reset output buffer for the next command
|
|
out.Reset()
|
|
|
|
cmdStatus := &StudioModeStatusCmd{}
|
|
err = cmdStatus.Run(context)
|
|
if err != nil {
|
|
t.Fatalf("failed to get studio mode status: %v", err)
|
|
}
|
|
if out.String() != "Studio mode is enabled\n" {
|
|
t.Fatalf("expected 'Studio mode is enabled', got: %s", out.String())
|
|
}
|
|
}
|
|
|
|
func TestStudioModeDisable(t *testing.T) {
|
|
client, disconnect := getClient(t)
|
|
defer disconnect()
|
|
|
|
var out bytes.Buffer
|
|
context := &context{
|
|
Client: client,
|
|
Out: &out,
|
|
}
|
|
|
|
cmdDisable := &StudioModeDisableCmd{}
|
|
err := cmdDisable.Run(context)
|
|
if err != nil {
|
|
t.Fatalf("failed to disable studio mode: %v", err)
|
|
}
|
|
if out.String() != "Studio mode is now disabled\n" {
|
|
t.Fatalf("expected 'Studio mode is now disabled', got: %s", out.String())
|
|
}
|
|
// Reset output buffer for the next command
|
|
out.Reset()
|
|
|
|
cmdStatus := &StudioModeStatusCmd{}
|
|
err = cmdStatus.Run(context)
|
|
if err != nil {
|
|
t.Fatalf("failed to get studio mode status: %v", err)
|
|
}
|
|
if out.String() != "Studio mode is disabled\n" {
|
|
t.Fatalf("expected 'Studio mode is disabled', got: %s", out.String())
|
|
}
|
|
}
|