// Copyright 2024 Matthew Rich . All rights reserved. package resource import ( "context" _ "encoding/json" _ "fmt" "github.com/stretchr/testify/assert" _ "gopkg.in/yaml.v3" _ "io" _ "log" _ "net/http" _ "net/http/httptest" _ "net/url" _ "os" _ "path/filepath" _ "strings" _ "syscall" "testing" _ "time" ) func TestNewNetworkRouteResource(t *testing.T) { n := NewNetworkRoute() assert.NotEqual(t, nil, n) } func TestNetworkRouteApplyResourceTransformation(t *testing.T) { n := NewNetworkRoute() assert.NotEqual(t, nil, n) //e := f.Apply() //assert.Equal(t, nil, e) } func TestReadNetworkRoute(t *testing.T) { ctx := context.Background() declarationAttributes := ` to: "192.168.0.0/24" gateway: "192.168.0.1" metric: 0 routetype: "unicast" scope: "link" state: present ` testRoute := NewNetworkRoute() e := testRoute.LoadDecl(declarationAttributes) assert.Nil(t, e) testRouteErr := testRoute.Apply() assert.Nil(t, testRouteErr) r, e := testRoute.Read(ctx) assert.Equal(t, "", ExitError(e)) assert.NotNil(t, r) assert.Equal(t, NetworkRouteType("unicast"), testRoute.RouteType) }