UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects

fix: remove customer

Merged Jason van Brackel requested to merge dev-remove-customer into master
56 files
+ 15
3863
Compare changes
  • Side-by-side
  • Inline
Files
56
package v1alpha1
import (
"reflect"
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// Reusable test variables
type testVarsAuthorizingOfficial = struct {
testKind string
testApiversion string
testSpec string
testStatus string
expectedKind string
expectedApiversion string
expectedSpec string
expectedStatus string
testObject1 AuthorizingOfficial
testObject2 AuthorizingOfficial
objectItems1 []AuthorizingOfficial
objectList1 AuthorizingOfficialList
objectItems2 []AuthorizingOfficial
objectList2 AuthorizingOfficialList
// leave scaffold Foo value for testing?
testObjectSpec1 AuthorizingOfficialSpec
testObjectSpec2 AuthorizingOfficialSpec
// leave scaffold Foo value for testing?
testObjectStatus1 AuthorizingOfficialStatus
testObjectStatus2 AuthorizingOfficialStatus
}
func initVarsAuthorizingOfficial() testVarsAuthorizingOfficial {
testVars := testVarsAuthorizingOfficial{}
testVars.testKind = "TestKind"
testVars.testApiversion = "v22"
testVars.testSpec = "test spec value"
testVars.testStatus = "test status value"
testVars.expectedApiversion = testVars.testApiversion
testVars.expectedKind = testVars.testKind
testVars.expectedSpec = testVars.testSpec
testVars.expectedStatus = testVars.testStatus
var object1MetaType metav1.TypeMeta = metav1.TypeMeta{Kind: testVars.testKind, APIVersion: testVars.testApiversion}
testVars.testObject1 = AuthorizingOfficial{TypeMeta: object1MetaType}
var object2MetaType metav1.TypeMeta = metav1.TypeMeta{Kind: "TestKind2", APIVersion: "V99"}
testVars.testObject2 = AuthorizingOfficial{TypeMeta: object2MetaType}
var objectList1MetaType metav1.TypeMeta = metav1.TypeMeta{Kind: "TestKind_List", APIVersion: "V12"}
var objectItems1 []AuthorizingOfficial = []AuthorizingOfficial{testVars.testObject1, testVars.testObject2}
// test_object_list = AuthorizingOfficialList(objectList1MetaType,nil,object_items)
testVars.objectList1 = AuthorizingOfficialList{TypeMeta: objectList1MetaType, Items: objectItems1}
var objectList2MetaType metav1.TypeMeta = metav1.TypeMeta{Kind: "TestKind_List", APIVersion: "V12"}
var objectItems2 []AuthorizingOfficial = []AuthorizingOfficial{testVars.testObject2}
// test_object_list = AuthorizingOfficialList(objectList1MetaType,nil,object_items)
testVars.objectList2 = AuthorizingOfficialList{TypeMeta: objectList2MetaType, Items: objectItems2}
// leave scaffold Foo value for testing?
testVars.testObjectSpec1 = AuthorizingOfficialSpec{Dummy: testVars.testSpec}
testVars.testObjectSpec2 = AuthorizingOfficialSpec{Dummy: "other value"}
// leave scaffold Foo value for testing?
testVars.testObjectStatus1 = AuthorizingOfficialStatus{Dummy: testVars.testStatus}
testVars.testObjectStatus2 = AuthorizingOfficialStatus{Dummy: "other value"}
return testVars
}
func TestGroupVars_AuthorizingOfficial(t *testing.T) {
xType := reflect.TypeOf(GroupVersion)
// convert object type to string
got := xType.String()
want := "schema.GroupVersion"
if got != want {
t.Errorf("got %s want %s", got, want)
}
t.Log("Success")
}
// Test Type called AuthorizingOfficial
func TestTypes_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
want := lTestVars.expectedApiversion
got := lTestVars.testObject1.APIVersion
if got != want {
t.Errorf("got %s want %s", got, want)
}
t.Log("Success")
}
// DeepCopy
func TestDeepCopy_DeepCopy_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
newObject := lTestVars.testObject1.DeepCopy()
// check api version
got := newObject.APIVersion
want := lTestVars.expectedApiversion
if got != want {
t.Errorf("got %s want %s", got, want)
}
// check kind
got = newObject.Kind
want = lTestVars.expectedKind
if got != want {
t.Errorf("got %s want %s", got, want)
}
var nilTestPtr *AuthorizingOfficial = nil
var val = nilTestPtr.DeepCopyObject()
if val != nil {
t.Errorf("got %s want %s", "not nil", "nil")
}
t.Log("Success")
}
func TestDeepCopy_DeepCopyInto_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
lTestVars.testObject1.DeepCopyInto(&lTestVars.testObject2)
got := lTestVars.testObject2.APIVersion
want := lTestVars.expectedApiversion
if got != want {
t.Errorf("got %s want %s", got, want)
}
t.Log("Success")
}
func TestDeepCopy_DeepCopyObject_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
newRuntimeObject := lTestVars.testObject1.DeepCopyObject()
newObject := newRuntimeObject.(*AuthorizingOfficial)
got := newObject.APIVersion
want := lTestVars.expectedApiversion
if got != want {
t.Errorf("got %s want %s", got, want)
}
t.Log("Success")
}
func TestDeepCopy_DeepCopyList_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
newObjectList := lTestVars.objectList1.DeepCopy()
got := newObjectList.Items[0].APIVersion
want := lTestVars.expectedApiversion
if got != want {
t.Errorf("got %s want %s", got, want)
}
// a typed pointer set to nil
var nilTestPtr *AuthorizingOfficialList = nil
var val = nilTestPtr.DeepCopy()
if val != nil {
t.Errorf("got %s want %s", "not nil", "nil")
}
t.Log("Success")
}
func TestDeepCopy_DeepCopyIntoList_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
lTestVars.objectList1.DeepCopyInto(&lTestVars.objectList2)
got := lTestVars.objectList2.Items[0].APIVersion
want := lTestVars.expectedApiversion
if got != want {
t.Errorf("got %s want %s", got, want)
}
t.Log("Success")
}
func TestDeepCopy_DeepCopyListObject_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
newRuntimeObject := lTestVars.objectList1.DeepCopyObject()
newObject := newRuntimeObject.(*AuthorizingOfficialList)
got := newObject.Items[0].APIVersion
want := lTestVars.expectedApiversion
if got != want {
t.Errorf("got %s want %s", got, want)
}
var nilTestPtr *AuthorizingOfficialList = nil
var val = nilTestPtr.DeepCopyObject()
if val != nil {
t.Errorf("got %s want %s", "not nil", "nil")
}
t.Log("Success")
}
func TestDeepCopy_DeepCopySpec_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
newObjectList := lTestVars.testObjectSpec1.DeepCopy()
got := newObjectList.Dummy
want := lTestVars.expectedSpec
if got != want {
t.Errorf("got %s want %s", got, want)
}
var nilTestPtr *AuthorizingOfficialSpec = nil
var val = nilTestPtr.DeepCopy()
if val != nil {
t.Errorf("got %s want %s", "not nil", "nil")
}
t.Log("Success")
}
func TestDeepCopy_DeepCopySpecInto_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
lTestVars.testObjectSpec1.DeepCopyInto(&lTestVars.testObjectSpec2)
got := lTestVars.testObjectSpec2.Dummy
want := lTestVars.expectedSpec
if got != want {
t.Errorf("got %s want %s", got, want)
}
t.Log("Success")
}
func TestDeepCopy_DeepCopyStatus_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
newObjectStatus := lTestVars.testObjectStatus1.DeepCopy()
got := newObjectStatus.Dummy
want := lTestVars.expectedStatus
if got != want {
t.Errorf("got %s want %s", got, want)
}
// a typed pointer set to nil
var nilTestPtr *AuthorizingOfficialStatus = nil
var val = nilTestPtr.DeepCopy()
if val != nil {
t.Errorf("got %s want %s", "not nil", "nil")
}
t.Log("Success")
}
func TestDeepCopy_DeepCopyStatusInto_AuthorizingOfficial(t *testing.T) {
lTestVars := initVarsAuthorizingOfficial()
lTestVars.testObjectStatus1.DeepCopyInto(&lTestVars.testObjectStatus2)
got := lTestVars.testObjectStatus2.Dummy
want := lTestVars.expectedStatus
if got != want {
t.Errorf("got %s want %s", got, want)
}
t.Log("Success")
}
Loading