github.com/david-imola/snapd@v0.0.0-20210611180407-2de8ddeece6d/overlord/snapstate/policy/policy_test.go (about) 1 package policy_test 2 3 import ( 4 "testing" 5 6 "gopkg.in/check.v1" 7 8 "github.com/snapcore/snapd/asserts" 9 "github.com/snapcore/snapd/overlord/snapstate" 10 "github.com/snapcore/snapd/overlord/snapstate/policy" 11 "github.com/snapcore/snapd/snap" 12 ) 13 14 // tie testing into check (only needed once per package) 15 func TestSnapManager(t *testing.T) { check.TestingT(t) } 16 17 type policySuite struct{} 18 19 var _ = check.Suite(&policySuite{}) 20 21 func (s *policySuite) TestFor(c *check.C) { 22 for typ, pol := range map[snap.Type]snapstate.Policy{ 23 snap.TypeApp: policy.NewAppPolicy(), 24 snap.TypeBase: policy.NewBasePolicy(""), 25 snap.TypeGadget: policy.NewGadgetPolicy(""), 26 snap.TypeKernel: policy.NewKernelPolicy(""), 27 snap.TypeOS: policy.NewOSPolicy(""), 28 snap.TypeSnapd: policy.NewSnapdPolicy(false), 29 } { 30 c.Check(policy.For(typ, &asserts.Model{}), check.FitsTypeOf, pol) 31 } 32 }