Add some more tests to make codecov happy

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar 2019-06-25 11:56:26 +02:00
parent 141235719b
commit 63b44b6681
2 changed files with 21 additions and 0 deletions

View file

@ -97,6 +97,11 @@ func (gosec *Analyzer) SetConfig(conf Config) {
gosec.config = conf gosec.config = conf
} }
// Config returns the current configuration
func (gosec *Analyzer) Config() Config {
return gosec.config
}
// LoadRules instantiates all the rules to be used when analyzing source // LoadRules instantiates all the rules to be used when analyzing source
// packages // packages
func (gosec *Analyzer) LoadRules(ruleDefinitions map[string]RuleBuilder) { func (gosec *Analyzer) LoadRules(ruleDefinitions map[string]RuleBuilder) {

View file

@ -416,6 +416,22 @@ var _ = Describe("Analyzer", func() {
Expect(ferr[1].Err).Should(MatchRegexp(`error2`)) Expect(ferr[1].Err).Should(MatchRegexp(`error2`))
} }
}) })
It("should set the config", func() {
config := gosec.NewConfig()
config["test"] = "test"
analyzer.SetConfig(config)
found := analyzer.Config()
Expect(config).To(Equal(found))
})
It("should reset the analyzer", func() {
analyzer.Reset()
issues, metrics, errors := analyzer.Report()
Expect(issues).To(BeEmpty())
Expect(*metrics).To(Equal(gosec.Metrics{}))
Expect(errors).To(BeEmpty())
})
}) })
Context("when appending errors", func() { Context("when appending errors", func() {