diff options
| author | Pawel Stolowski <stolowski@gmail.com> | 2017-10-19 17:57:16 +0200 |
|---|---|---|
| committer | Pawel Stolowski <stolowski@gmail.com> | 2017-10-19 17:57:16 +0200 |
| commit | 2b41efcede750855b3401e0a7e267a979d49279e (patch) | |
| tree | c80dbae68886b78bfc4be3724530a1613547ee76 | |
| parent | bc06d513a9068ffce161bd5fc6bf0e41b8c1925b (diff) | |
Reduce duplicated code in interface tests mocks.test-cleanup2
| -rw-r--r-- | interfaces/builtin/utils_test.go | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/interfaces/builtin/utils_test.go b/interfaces/builtin/utils_test.go index ccb4eb2ff2..715e9f61a8 100644 --- a/interfaces/builtin/utils_test.go +++ b/interfaces/builtin/utils_test.go @@ -20,15 +20,12 @@ package builtin_test import ( - "fmt" - . "gopkg.in/check.v1" "github.com/snapcore/snapd/interfaces" "github.com/snapcore/snapd/interfaces/builtin" "github.com/snapcore/snapd/interfaces/ifacetest" "github.com/snapcore/snapd/snap" - "github.com/snapcore/snapd/snap/snaptest" ) type utilsSuite struct { @@ -67,17 +64,9 @@ func (s *utilsSuite) TestSanitizeSlotReservedForOSOrApp(c *C) { } func MockPlug(c *C, yaml string, si *snap.SideInfo, plugName string) *interfaces.Plug { - info := snaptest.MockInfo(c, yaml, si) - if plugInfo, ok := info.Plugs[plugName]; ok { - return &interfaces.Plug{PlugInfo: plugInfo} - } - panic(fmt.Sprintf("cannot find plug %q in snap %q", plugName, info.Name())) + return builtin.MockPlug(c, yaml, si, plugName) } func MockSlot(c *C, yaml string, si *snap.SideInfo, slotName string) *interfaces.Slot { - info := snaptest.MockInfo(c, yaml, si) - if slotInfo, ok := info.Slots[slotName]; ok { - return &interfaces.Slot{SlotInfo: slotInfo} - } - panic(fmt.Sprintf("cannot find slot %q in snap %q", slotName, info.Name())) + return builtin.MockSlot(c, yaml, si, slotName) } |
