|
package groups_test
import (
"testing"
"github.com/RedHatInsights/insights-content-service/groups"
)
|
TestParseGroupConfigFileNonExistingFile check whether non existing file is detected properly
|
func TestParseGroupConfigFileNonExistingFile ( t * testing . T ) {
|
the following file does not exist
|
_ , err := groups . ParseGroupConfigFile ( "this does not exist" )
if err == nil {
t . Log ( err )
t . Fatal ( "Error should be returned for non existing file" )
}
}
|
TestParseGroupConfigFileNonExistingFile check whether non YAML file is detected properly
|
func TestParseGroupConfigFileNotYamlFile ( t * testing . T ) {
|
the following file does exist, but it is not proper YAML file
|
_ , err := groups . ParseGroupConfigFile ( "../LICENSE" )
if err == nil {
t . Log ( err )
t . Fatal ( "Error should be returned for improper file format" )
}
}
|
TestParseGroupConfigFileProperYamlFile is basic test for checking whether group configuration file can be read properly
|
func TestParseGroupConfigFileProperYamlFile ( t * testing . T ) {
|
the following file does exist, but it is not proper YAML file
|
_ , err := groups . ParseGroupConfigFile ( "../groups_config.yaml" )
if err != nil {
t . Log ( err )
t . Fatal ( "Error should not be returned for existing and proper file" )
}
|
TODO: more checks will need test_config.yaml
|
}
|