зеркало из https://github.com/mozilla/doorman.git
Improve coverage
This commit is contained in:
Родитель
da3b5c32cb
Коммит
6233b8185f
|
@ -77,6 +77,19 @@ policies:
|
|||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestLoadPolicies(t *testing.T) {
|
||||
// Service as integer
|
||||
configs, err := loadTempFiles(`
|
||||
service: 1
|
||||
policies:
|
||||
-
|
||||
id: "1"
|
||||
effect: allow
|
||||
`)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, configs[0].Service, "1")
|
||||
}
|
||||
|
||||
func TestLoadFolder(t *testing.T) {
|
||||
// Create temp dir
|
||||
dir, err := ioutil.TempDir("", "example")
|
||||
|
|
|
@ -158,6 +158,25 @@ func TestBadServicesConfig(t *testing.T) {
|
|||
},
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
|
||||
// Unknown condition type
|
||||
err = d.LoadPolicies(ServicesConfig{
|
||||
ServiceConfig{
|
||||
Service: "a",
|
||||
Policies: Policies{
|
||||
Policy{
|
||||
ID: "1",
|
||||
Conditions: Conditions{
|
||||
"owner": Condition{
|
||||
Type: "healthy",
|
||||
},
|
||||
},
|
||||
Effect: "allow",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestLoadPoliciesTwice(t *testing.T) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче