func (s *prepareSnapSuite) SetUpTest(c *C) { s.fakeBackend = &fakeSnappyBackend{} s.state = state.New(nil) var err error s.snapmgr, err = snapstate.Manager(s.state) c.Assert(err, IsNil) s.snapmgr.AddForeignTaskHandlers(s.fakeBackend) snapstate.SetSnapManagerBackend(s.snapmgr, s.fakeBackend) s.reset = snapstate.MockReadInfo(s.fakeBackend.ReadInfo) }
func (s *downloadSnapSuite) SetUpTest(c *C) { s.fakeBackend = &fakeSnappyBackend{} s.state = state.New(nil) s.state.Lock() defer s.state.Unlock() s.fakeStore = &fakeStore{ state: s.state, fakeBackend: s.fakeBackend, } snapstate.ReplaceStore(s.state, s.fakeStore) var err error s.snapmgr, err = snapstate.Manager(s.state) c.Assert(err, IsNil) s.snapmgr.AddForeignTaskHandlers(s.fakeBackend) snapstate.SetSnapManagerBackend(s.snapmgr, s.fakeBackend) s.reset = snapstate.MockReadInfo(s.fakeBackend.ReadInfo) }