func (openControl *OpenControlGitBook) getCoveredByVerification(text string, component common.Component, coveredBy common.CoveredBy) string {
	if component != nil {
		verification := component.GetVerifications().Get(coveredBy.VerificationKey)
		text += exportLink(
			fmt.Sprintf("%s - %s", component.GetName(), verification.Name),
			filepath.Join("..", "components", component.GetKey()+".md"),
		)
	}
	return text
}
Ejemplo n.º 2
0
func testSet(example common.Component, actual common.Component, t *testing.T) {
	// Check that the key was loaded
	if example.GetKey() != actual.GetKey() {
		t.Errorf("Expected %s, Actual: %s", example.GetKey(), actual.GetKey())
	}
	// Check that the name was loaded
	if example.GetName() != actual.GetName() {
		t.Errorf("Expected %s, Actual: %s", example.GetName(), actual.GetName())
	}
	// Check that the schema version was loaded
	if example.GetVersion().NE(actual.GetVersion()) {
		t.Errorf("Expected %v, Actual: %v", example.GetVersion(), actual.GetVersion())
	}
	// Check that the references were loaded
	if example.GetReferences().Len() != actual.GetReferences().Len() {
		t.Errorf("Expected %d, Actual: %d", example.GetReferences().Len(), actual.GetReferences().Len())
	}
	// Check that the satisfies data was loaded
	if len(example.GetAllSatisfies()) != len(actual.GetAllSatisfies()) {
		t.Errorf("Expected %d, Actual: %d", len(example.GetAllSatisfies()), len(actual.GetAllSatisfies()))
	}
	// Check Narratives and Parameters.
	for idx, _ := range actual.GetAllSatisfies() {
		assert.Equal(t, (example.GetAllSatisfies())[idx].GetNarratives(), (actual.GetAllSatisfies())[idx].GetNarratives())
		assert.Equal(t, (example.GetAllSatisfies())[idx].GetParameters(), (actual.GetAllSatisfies())[idx].GetParameters())
		assert.Equal(t, (example.GetAllSatisfies())[idx].GetControlOrigin(), (actual.GetAllSatisfies())[idx].GetControlOrigin())
		assert.Equal(t, (example.GetAllSatisfies())[idx].GetControlOrigins(), (actual.GetAllSatisfies())[idx].GetControlOrigins())
		assert.Equal(t, (example.GetAllSatisfies())[idx].GetImplementationStatus(), (actual.GetAllSatisfies())[idx].GetImplementationStatus())
		assert.Equal(t, (example.GetAllSatisfies())[idx].GetImplementationStatuses(), (actual.GetAllSatisfies())[idx].GetImplementationStatuses())
	}
	// Check the responsible role.
	assert.Equal(t, example.GetResponsibleRole(), actual.GetResponsibleRole())
	// Check that the verifications were loaded
	if example.GetVerifications().Len() != actual.GetVerifications().Len() {
		t.Errorf("Expected %d, Actual: %d", example.GetVerifications().Len(), actual.GetVerifications())
	}
}