// LoadCertification struct loads certifications into a Certification struct // and add it to the main object. func (ws *localWorkspace) LoadCertification(certificationFile string) error { cert, err := certifications.Load(certificationFile) if err != nil { return err } ws.certification = cert return nil }
func TestLoadCertificationErrors(t *testing.T) { for _, example := range certificationTestErrors { _, actualError := certifications.Load(example.certificationFile) // Check that the expected error is the actual error returned if example.expectedError != actualError { t.Errorf("Expected %s, Actual: %s", example.expectedError, actualError) } } }
func TestLoadCertification(t *testing.T) { for _, example := range v1certificationTests { actual, err := certifications.Load(example.certificationFile) assert.Nil(t, err) // Check if loaded certification has the expected key if actual.GetKey() != example.expected.GetKey() { t.Errorf("Expected %s, Actual: %s", example.expected.GetKey(), actual.GetKey()) } for expectedStandardKey, expectedControls := range example.expectedControls { assert.Equal(t, len(actual.GetControlKeysFor(expectedStandardKey)), len(expectedControls)) assert.Equal(t, actual.GetControlKeysFor(expectedStandardKey), expectedControls) } } }