jx/internal/resource/os_test.go

38 lines
666 B
Go
Raw Normal View History

2024-03-20 19:23:31 +00:00
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
2024-03-20 16:15:27 +00:00
package resource
import (
2024-03-25 20:31:06 +00:00
_ "context"
_ "encoding/json"
_ "fmt"
"github.com/stretchr/testify/assert"
_ "io"
_ "net/http"
_ "net/http/httptest"
_ "net/url"
_ "strings"
"testing"
2024-03-20 16:15:27 +00:00
)
func TestLookupUID(t *testing.T) {
2024-03-25 20:31:06 +00:00
uid, e := LookupUID("nobody")
2024-03-20 16:15:27 +00:00
2024-04-18 00:07:12 +00:00
assert.Nil(t, e)
2024-03-25 20:31:06 +00:00
assert.Equal(t, 65534, uid)
2024-04-18 00:07:12 +00:00
nuid, ne := LookupUID("1001")
assert.Nil(t, ne)
assert.Equal(t, 1001, nuid)
2024-03-20 16:15:27 +00:00
}
func TestLookupGID(t *testing.T) {
2024-03-25 20:31:06 +00:00
gid, e := LookupGID("nobody")
2024-03-20 16:15:27 +00:00
2024-04-18 00:07:12 +00:00
assert.Nil(t, e)
2024-03-25 20:31:06 +00:00
assert.Equal(t, 65534, gid)
2024-03-20 16:15:27 +00:00
2024-04-18 00:07:12 +00:00
ngid, ne := LookupGID("1001")
assert.Nil(t, ne)
assert.Equal(t, 1001, ngid)
2024-03-20 16:15:27 +00:00
}