aboutsummaryrefslogtreecommitdiff
path: root/config/app_test.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--config/app_test.go26
1 files changed, 23 insertions, 3 deletions
diff --git a/config/app_test.go b/config/app_test.go
index cda891d..5a6cf41 100644
--- a/config/app_test.go
+++ b/config/app_test.go
@@ -55,9 +55,7 @@ func TestAppvalidate(t *testing.T) {
t.Fatal("Negative or zero MenuMaxIdleTime should not be valid.")
}
- //PostLoginCommands is tested from command.go
-
- // A valid App
+ //PostLoginCommands are mostly tested from command_test.go
app = App{
WorkingDirectory: "var/",
MaxUsers: 512,
@@ -65,6 +63,28 @@ func TestAppvalidate(t *testing.T) {
MenuMaxIdleTime: 60,
}
if err := app.validate(); err != nil {
+ t.Fatal("Empty PostLoginCommands list should be valid")
+ }
+ app = App{
+ WorkingDirectory: "var/",
+ MaxUsers: 512,
+ MaxNickLen: 15,
+ MenuMaxIdleTime: 60,
+ PostLoginCommands: []string{"invalid"},
+ }
+ if err := app.validate(); err == nil {
+ t.Fatal("Invalid command in PostLoginCommands should not be valid")
+ }
+
+ // A valid App
+ app = App{
+ WorkingDirectory: "var/",
+ MaxUsers: 512,
+ MaxNickLen: 15,
+ MenuMaxIdleTime: 60,
+ PostLoginCommands: []string{"wait"},
+ }
+ if err := app.validate(); err != nil {
t.Fatal("A valid app should pass")
}
}