-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Galadriel Server Admin CLI - create methods
Adding create methods to the Server CLI.
- Loading branch information
Showing
12 changed files
with
336 additions
and
239 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
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,17 @@ | ||
package cli | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestTokenCmd(t *testing.T) { | ||
cmd := &cobra.Command{} | ||
cmd.Flags().String("trustDomain", "test.com", "") | ||
|
||
err := cmd.Execute() | ||
|
||
assert.Nil(t, err) | ||
} |
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 |
---|---|---|
@@ -1 +1,45 @@ | ||
package cli | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestLoadConfig(t *testing.T) { | ||
tempFile, err := os.CreateTemp("", "server.conf") | ||
assert.NoError(t, err) | ||
defer os.Remove(tempFile.Name()) | ||
|
||
_, err = tempFile.WriteString(` | ||
server { | ||
listen_address = "localhost" | ||
listen_port = "8085" | ||
socket_path = "/tmp/galadriel-server/api.sock/" | ||
log_level = "DEBUG" | ||
} | ||
providers { | ||
Datastore "postgres" { | ||
connection_string = "postgresql://postgres:postgres@localhost:5432/galadriel" | ||
} | ||
X509CA "disk" { | ||
key_file_path = "./conf/server/dummy_root_ca.key" | ||
cert_file_path = "./conf/server/dummy_root_ca.crt" | ||
} | ||
KeyManager "memory" {} | ||
} | ||
`) | ||
assert.NoError(t, err) | ||
|
||
cmd := &cobra.Command{} | ||
cmd.Flags().String("config", tempFile.Name(), "") | ||
|
||
config, err := LoadConfig(cmd) | ||
|
||
assert.NoError(t, err) | ||
assert.NotNil(t, config) | ||
} |
Oops, something went wrong.