Skip to content

Commit

Permalink
test(login1): add tests for get property methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyam8 committed Aug 31, 2022
1 parent b106c7d commit aa064ac
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions login1/dbus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,27 @@ func TestConn_GetSessionPropertiesContext(t *testing.T) {
}

func TestConn_GetSessionPropertyContext(t *testing.T) {
c, err := New()
if err != nil {
t.Fatal(err)
}

sessions, err := c.ListSessions()
if err != nil {
t.Fatal(err)
}

for _, s := range sessions {
func() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
defer cancel()

_, err := c.GetSessionPropertyContext(ctx, s.Path, "Remote")
if err != nil {
t.Fatal(err)
}
}()
}
}

func TestConn_GetUserPropertiesContext(t *testing.T) {
Expand Down Expand Up @@ -149,5 +169,25 @@ func TestConn_GetUserPropertiesContext(t *testing.T) {
}

func TestConn_GetUserPropertyContext(t *testing.T) {
c, err := New()
if err != nil {
t.Fatal(err)
}

users, err := c.ListUsers()
if err != nil {
t.Fatal(err)
}

for _, u := range users {
func() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
defer cancel()

_, err := c.GetUserPropertyContext(ctx, u.Path, "State")
if err != nil {
t.Fatal(err)
}
}()
}
}

0 comments on commit aa064ac

Please sign in to comment.