Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tavern/internal/c2/c2pb/enum_host_platform_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
package c2pb_test

import (
"bytes"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"realm.pub/tavern/internal/c2/c2pb"
)

func TestHostPlatformValues(t *testing.T) {
assert.NotEmpty(t, c2pb.Host_Platform(0).Values())
}

func TestHostPlatformValue(t *testing.T) {
val, err := c2pb.Host_Platform(0).Value()
require.NoError(t, err)
require.NotNil(t, val)
}

func TestHostPlatformMarshalGraphQL(t *testing.T) {
var buf bytes.Buffer
c2pb.Host_Platform(0).MarshalGQL(&buf)
assert.Equal(t, `"PLATFORM_UNSPECIFIED"`, buf.String())
}

func TestHostPlatformUnmarshalGraphQL(t *testing.T) {
var platform c2pb.Host_Platform
assert.NoError(t, (*c2pb.Host_Platform).UnmarshalGQL(&platform, `PLATFORM_LINUX`))
assert.Equal(t, c2pb.Host_PLATFORM_LINUX, platform)
}

func TestHostPlatformScan(t *testing.T) {
tests := []struct {
name string
Expand Down
24 changes: 24 additions & 0 deletions tavern/internal/c2/c2pb/enum_process_status_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
package c2pb_test

import (
"bytes"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"realm.pub/tavern/internal/c2/c2pb"
)

func TestProcessStatusValues(t *testing.T) {
assert.NotEmpty(t, c2pb.Process_Status(0).Values())
}

func TestProcessStatusValue(t *testing.T) {
val, err := c2pb.Process_Status(0).Value()
require.NoError(t, err)
require.NotNil(t, val)
}

func TestProcessStatusMarshalGraphQL(t *testing.T) {
var buf bytes.Buffer
c2pb.Process_Status(0).MarshalGQL(&buf)
assert.Equal(t, `"STATUS_UNSPECIFIED"`, buf.String())
}

func TestProcessStatusUnmarshalGraphQL(t *testing.T) {
var status c2pb.Process_Status
assert.NoError(t, (*c2pb.Process_Status).UnmarshalGQL(&status, `STATUS_IDLE`))
assert.Equal(t, c2pb.Process_STATUS_IDLE, status)
}

func TestProcessStatusScan(t *testing.T) {
tests := []struct {
name string
Expand Down