-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase test coverage for standards
- Loading branch information
James C. Scott
committed
Aug 19, 2016
1 parent
7f1c5cc
commit 0e1d033
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package lib | ||
|
||
import ( | ||
"testing" | ||
"github.com/opencontrol/compliance-masonry/lib/common/mocks" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/opencontrol/compliance-masonry/lib/common" | ||
) | ||
|
||
func TestGetStandard(t *testing.T) { | ||
// Setup map | ||
m := newStandards() | ||
// Get nil component. | ||
standard := m.Get("test") | ||
assert.Nil(t, standard) | ||
// Create mock component | ||
newStandard := new(mocks.Standard) | ||
newStandard.On("GetName").Return("test") | ||
// Test add method | ||
m.Add(newStandard) | ||
// Try to retrieve the component again. | ||
standard = m.Get("test") | ||
assert.Equal(t, standard.GetName(), "test") | ||
} | ||
|
||
func TestBadLoadStandard(t *testing.T) { | ||
// Setup map | ||
m := newStandards() | ||
ws := LocalWorkspace{Standards: m} | ||
err := ws.LoadStandard("fake.file") | ||
assert.NotNil(t, err) | ||
assert.Equal(t, common.ErrStandardSchema, err) | ||
} |