add property definitions and show test

This commit is contained in:
Tai Groot
2021-05-15 14:24:31 -07:00
parent 8a7c865b5f
commit 322e3458ac
4 changed files with 518 additions and 5 deletions

View File

@@ -4,6 +4,8 @@ import (
"context"
"testing"
"time"
"github.com/taigrr/systemctl/properties"
)
func TestEnableNonexistant(t *testing.T) {
@@ -51,3 +53,17 @@ func TestEnableSuccess(t *testing.T) {
t.Errorf("error is %v, but should have been %v", err, nil)
}
}
func TestAllProperties(t *testing.T) {
unit := "nginx"
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
opts := Options{
usermode: true,
}
for _, x := range properties.Properties {
_, err := Show(ctx, unit, x, opts)
if err != nil {
t.Errorf("error is %v, but should have been %v", err, nil)
}
}
}