orchestratortest

package
v2.0.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MockAssessmentResultRequest1 = &orchestrator.GetAssessmentResultRequest{
		Id: testdata.MockAssessmentResult1ID,
	}
	MockAssessmentResultRequest2 = &orchestrator.GetAssessmentResultRequest{
		Id: testdata.MockAssessmentResult2ID,
	}
	MockAssessmentResult1 = &assessment.AssessmentResult{
		Id:             testdata.MockAssessmentResult1ID,
		Timestamp:      timestamppb.New(time.Unix(1, 0)),
		CloudServiceId: testdata.MockCloudServiceID1,
		MetricId:       testdata.MockMetricID1,
		Compliant:      true,
		EvidenceId:     testdata.MockEvidenceID1,
		ResourceId:     testdata.MockResourceID1,
		ResourceTypes:  []string{"Resource"},
		MetricConfiguration: &assessment.MetricConfiguration{
			Operator:       "==",
			TargetValue:    structpb.NewBoolValue(true),
			IsDefault:      true,
			MetricId:       testdata.MockMetricID1,
			CloudServiceId: testdata.MockCloudServiceID1,
		},
		ToolId: util.Ref(assessment.AssessmentToolId),
	}
	MockAssessmentResult2 = &assessment.AssessmentResult{
		Id:             testdata.MockAssessmentResult2ID,
		Timestamp:      timestamppb.New(time.Unix(1, 0)),
		CloudServiceId: testdata.MockCloudServiceID2,
		MetricId:       testdata.MockMetricID1,
		Compliant:      true,
		EvidenceId:     testdata.MockEvidenceID1,
		ResourceId:     testdata.MockResourceID1,
		ResourceTypes:  []string{"Resource"},
		MetricConfiguration: &assessment.MetricConfiguration{
			Operator:       "==",
			TargetValue:    structpb.NewBoolValue(true),
			IsDefault:      true,
			MetricId:       testdata.MockMetricID1,
			CloudServiceId: testdata.MockCloudServiceID2,
		},
		ToolId: util.Ref(assessment.AssessmentToolId),
	}
	MockAssessmentResult3 = &assessment.AssessmentResult{
		Id:             testdata.MockAssessmentResult3ID,
		Timestamp:      timestamppb.New(time.Unix(1, 0)),
		CloudServiceId: testdata.MockCloudServiceID1,
		MetricId:       testdata.MockMetricID2,
		Compliant:      false,
		EvidenceId:     testdata.MockEvidenceID1,
		ResourceId:     testdata.MockResourceID1,
		ResourceTypes:  []string{"Resource"},
		MetricConfiguration: &assessment.MetricConfiguration{
			Operator:       "==",
			TargetValue:    structpb.NewBoolValue(true),
			IsDefault:      true,
			MetricId:       testdata.MockMetricID2,
			CloudServiceId: testdata.MockCloudServiceID1,
		},
		ToolId: util.Ref(assessment.AssessmentToolId),
	}
	MockAssessmentResult4 = &assessment.AssessmentResult{
		Id:             testdata.MockAssessmentResult4ID,
		Timestamp:      timestamppb.New(time.Unix(1, 0)),
		CloudServiceId: testdata.MockCloudServiceID2,
		MetricId:       testdata.MockMetricID2,
		Compliant:      false,
		EvidenceId:     testdata.MockEvidenceID1,
		ResourceId:     testdata.MockResourceID2,
		ResourceTypes:  []string{"Resource"},
		MetricConfiguration: &assessment.MetricConfiguration{
			Operator:       "==",
			TargetValue:    structpb.NewBoolValue(true),
			IsDefault:      true,
			MetricId:       testdata.MockMetricID2,
			CloudServiceId: testdata.MockCloudServiceID2,
		},
		ToolId: util.Ref(testdata.MockAssessmentResultToolID),
	}
	MockAssessmentResults = []*assessment.AssessmentResult{MockAssessmentResult1, MockAssessmentResult2, MockAssessmentResult3, MockAssessmentResult4}

	MockControl1 = &orchestrator.Control{
		Id:                testdata.MockControlID1,
		Name:              testdata.MockControlName,
		CategoryName:      testdata.MockCategoryName,
		CategoryCatalogId: testdata.MockCatalogID,
		Description:       testdata.MockControlDescription,
		Controls: []*orchestrator.Control{
			{
				Id:                             testdata.MockSubControlID11,
				Name:                           testdata.MockSubControlName,
				CategoryName:                   testdata.MockCategoryName,
				CategoryCatalogId:              testdata.MockCatalogID,
				Description:                    testdata.MockSubControlDescription,
				AssuranceLevel:                 &testdata.AssuranceLevelBasic,
				ParentControlId:                util.Ref(testdata.MockControlID1),
				ParentControlCategoryName:      util.Ref(testdata.MockCategoryName),
				ParentControlCategoryCatalogId: util.Ref(testdata.MockCatalogID),
				Metrics: []*assessment.Metric{{
					Id:          testdata.MockMetricID1,
					Name:        testdata.MockMetricName1,
					Description: testdata.MockMetricDescription1,
					Scale:       assessment.Metric_ORDINAL,
					Range: &assessment.Range{
						Range: &assessment.Range_AllowedValues{
							AllowedValues: &assessment.AllowedValues{
								Values: []*structpb.Value{
									structpb.NewBoolValue(false),
									structpb.NewBoolValue(true),
								},
							},
						},
					},
				}}},
		}}
	MockControl11 = &orchestrator.Control{
		Id:                             testdata.MockSubControlID11,
		Name:                           testdata.MockSubControlName,
		CategoryName:                   testdata.MockCategoryName,
		CategoryCatalogId:              testdata.MockCatalogID,
		Description:                    testdata.MockSubControlDescription,
		AssuranceLevel:                 &testdata.AssuranceLevelBasic,
		ParentControlId:                util.Ref(testdata.MockControlID1),
		ParentControlCategoryName:      util.Ref(testdata.MockCategoryName),
		ParentControlCategoryCatalogId: util.Ref(testdata.MockCatalogID),
		Metrics: []*assessment.Metric{{
			Id:          testdata.MockMetricID1,
			Name:        testdata.MockMetricName1,
			Description: testdata.MockMetricDescription1,
			Scale:       assessment.Metric_ORDINAL,
			Range: &assessment.Range{
				Range: &assessment.Range_AllowedValues{
					AllowedValues: &assessment.AllowedValues{
						Values: []*structpb.Value{
							structpb.NewBoolValue(false),
							structpb.NewBoolValue(true),
						},
					},
				},
			},
		},
		}}
	MockControl2 = &orchestrator.Control{
		Id:                testdata.MockControlID2,
		Name:              testdata.MockControlName,
		CategoryName:      testdata.MockCategoryName,
		CategoryCatalogId: testdata.MockCatalogID,
		Description:       testdata.MockControlDescription,
		Controls: []*orchestrator.Control{
			{
				Id:                             testdata.MockSubControlID21,
				Name:                           testdata.MockControlName,
				CategoryName:                   testdata.MockCategoryName,
				CategoryCatalogId:              testdata.MockCatalogID,
				Description:                    testdata.MockControlDescription,
				AssuranceLevel:                 &testdata.AssuranceLevelBasic,
				ParentControlId:                util.Ref(testdata.MockControlID2),
				ParentControlCategoryName:      util.Ref(testdata.MockCategoryName),
				ParentControlCategoryCatalogId: util.Ref(testdata.MockCatalogID),
				Metrics: []*assessment.Metric{{
					Id:          testdata.MockMetricID1,
					Name:        testdata.MockMetricName1,
					Description: testdata.MockMetricDescription1,
					Scale:       assessment.Metric_ORDINAL,
					Range: &assessment.Range{
						Range: &assessment.Range_AllowedValues{
							AllowedValues: &assessment.AllowedValues{
								Values: []*structpb.Value{
									structpb.NewBoolValue(false),
									structpb.NewBoolValue(true),
								},
							},
						},
					},
				}}},
		}}
	MockControl3 = &orchestrator.Control{
		Id:                testdata.MockControlID3,
		Name:              testdata.MockControlName,
		CategoryName:      testdata.MockCategoryName,
		CategoryCatalogId: testdata.MockCatalogID,
		Description:       testdata.MockControlDescription,
		Controls: []*orchestrator.Control{
			{
				Id:                             testdata.MockSubControlID31,
				Name:                           testdata.MockControlName,
				CategoryName:                   testdata.MockCategoryName,
				CategoryCatalogId:              testdata.MockCatalogID,
				Description:                    testdata.MockControlDescription,
				AssuranceLevel:                 &testdata.AssuranceLevelSubstantial,
				ParentControlId:                util.Ref(testdata.MockControlID3),
				ParentControlCategoryName:      util.Ref(testdata.MockCategoryName),
				ParentControlCategoryCatalogId: util.Ref(testdata.MockCatalogID),
			}},
	}
	MockControl4 = &orchestrator.Control{
		Id:                testdata.MockControlID4,
		Name:              testdata.MockControlName,
		CategoryName:      testdata.MockCategoryName,
		CategoryCatalogId: testdata.MockCatalogID,
		Description:       testdata.MockControlDescription,
		AssuranceLevel:    &testdata.AssuranceLevelHigh,
		Metrics: []*assessment.Metric{{
			Id:          testdata.MockMetricID1,
			Name:        testdata.MockMetricName1,
			Description: testdata.MockMetricDescription1,
			Scale:       assessment.Metric_ORDINAL,
			Range: &assessment.Range{
				Range: &assessment.Range_AllowedValues{
					AllowedValues: &assessment.AllowedValues{
						Values: []*structpb.Value{
							structpb.NewBoolValue(false),
							structpb.NewBoolValue(true),
						},
					},
				},
			},
		}},
	}
	MockControl5 = &orchestrator.Control{
		Id:                testdata.MockControlID5,
		Name:              testdata.MockControlName,
		CategoryName:      testdata.MockCategoryName,
		CategoryCatalogId: testdata.MockCatalogID,
		Description:       testdata.MockControlDescription,
		AssuranceLevel:    nil,
		Metrics: []*assessment.Metric{{
			Id:          testdata.MockMetricID1,
			Name:        testdata.MockMetricName1,
			Description: testdata.MockMetricDescription1,
			Scale:       assessment.Metric_ORDINAL,
			Range: &assessment.Range{
				Range: &assessment.Range_AllowedValues{
					AllowedValues: &assessment.AllowedValues{
						Values: []*structpb.Value{
							structpb.NewBoolValue(false),
							structpb.NewBoolValue(true),
						},
					},
				},
			},
		}},
	}
	// Control without sub-control
	MockControl6 = &orchestrator.Control{
		Id:                testdata.MockControlID1,
		Name:              testdata.MockControlName,
		CategoryName:      testdata.MockCategoryName,
		CategoryCatalogId: testdata.MockCatalogID,
		Description:       testdata.MockControlDescription,
	}
	MockControls = []*orchestrator.Control{MockControl1, MockControl2, MockControl3, MockControl4, MockControl5}
)

Functions

func NewAnotherCloudService

func NewAnotherCloudService() *orchestrator.CloudService

func NewCatalog

func NewCatalog() *orchestrator.Catalog

NewCatalog creates a mock catalog

func NewCertificate

func NewCertificate(opts ...NewCertificateOption) *orchestrator.Certificate

NewCertificate creates a mock certificate.

func NewCertificate2

func NewCertificate2() *orchestrator.Certificate

NewCertificate2 creates a mock certificate with other properties than NewCertificate

func NewCloudService

func NewCloudService() *orchestrator.CloudService

func NewMetric

func NewMetric() *assessment.Metric

func NewTargetOfEvaluation

func NewTargetOfEvaluation(assuranceLevel string) *orchestrator.TargetOfEvaluation

NewTargetOfEvaluation creates a new Target of Evaluation. The assurance level is set if available.

Types

type NewCertificateOption

type NewCertificateOption func(*orchestrator.Certificate)

NewCertificateOption is an option for NewCertificate to modify single properties for testing , e.g., Update endpoint

func WithDescription

func WithDescription(description string) NewCertificateOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL