MCPcopy Create free account
hub / github.com/clouditor/clouditor / TestService_getControl

Function TestService_getControl

service/evaluation/evaluation_test.go:995–1117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

993}
994
995func TestService_getControl(t *testing.T) {
996 type fields struct {
997 UnimplementedEvaluationServer evaluation.UnimplementedEvaluationServer
998 orchestrator *api.RPCConnection[orchestrator.OrchestratorClient]
999 scheduler *gocron.Scheduler
1000 storage persistence.Storage
1001 catalogControls map[string]map[string]*orchestrator.Control
1002 }
1003 type args struct {
1004 catalogId string
1005 categoryName string
1006 controlId string
1007 }
1008 tests := []struct {
1009 name string
1010 fields fields
1011 args args
1012 want assert.Want[*orchestrator.Control]
1013 wantErr assert.ErrorAssertionFunc
1014 }{
1015 {
1016 name: "catalog_id is missing",
1017 fields: fields{},
1018 args: args{
1019 categoryName: testdata.MockCategoryName,
1020 controlId: testdata.MockControlID1,
1021 },
1022 want: nil,
1023 wantErr: func(tt assert.TestingT, err error, i ...interface{}) bool {
1024 return assert.ErrorIs(t, err, ErrCatalogIdIsMissing)
1025 },
1026 },
1027 {
1028 name: "category_name is missing",
1029 fields: fields{},
1030 args: args{
1031 catalogId: testdata.MockCatalogID,
1032 controlId: testdata.MockControlID1,
1033 },
1034 want: nil,
1035 wantErr: func(tt assert.TestingT, err error, i ...interface{}) bool {
1036 return assert.ErrorIs(t, err, ErrCategoryNameIsMissing)
1037 },
1038 },
1039 {
1040 name: "control_id is missing",
1041 fields: fields{},
1042 args: args{
1043 catalogId: testdata.MockCatalogID,
1044 categoryName: testdata.MockCategoryName,
1045 },
1046 want: nil,
1047 wantErr: func(tt assert.TestingT, err error, i ...interface{}) bool {
1048 return assert.ErrorIs(t, err, ErrControlIdIsMissing)
1049 },
1050 },
1051 {
1052 name: "control does not exist",

Callers

nothing calls this directly

Calls 6

getControlMethod · 0.95
EqualFunction · 0.92
GetCategoryCatalogIdMethod · 0.80
ErrorfMethod · 0.80
GetIdMethod · 0.65
GetCategoryNameMethod · 0.45

Tested by

no test coverage detected