From a37f50c51514a22c3ea1fb4aa374ef940c39ad16 Mon Sep 17 00:00:00 2001 From: quobix Date: Sun, 4 Aug 2024 20:55:04 -0400 Subject: [PATCH] bumped coverage --- datamodel/low/base/context_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 datamodel/low/base/context_test.go diff --git a/datamodel/low/base/context_test.go b/datamodel/low/base/context_test.go new file mode 100644 index 0000000..a86faf5 --- /dev/null +++ b/datamodel/low/base/context_test.go @@ -0,0 +1,23 @@ +// Copyright 2023-2024 Princess Beef Heavy Industries, LLC / Dave Shanley +// https://pb33f.io + +package base + +import ( + "github.com/stretchr/testify/assert" + "golang.org/x/net/context" + "testing" +) + +func TestGetModelContext(t *testing.T) { + + assert.Nil(t, GetModelContext(nil)) + assert.Nil(t, GetModelContext(context.Background())) + + ctx := context.WithValue(context.Background(), "modelCtx", &ModelContext{}) + assert.NotNil(t, GetModelContext(ctx)) + + ctx = context.WithValue(context.Background(), "modelCtx", "wrong") + assert.Nil(t, GetModelContext(ctx)) + +}