github.com/stolowski/snapd@v0.0.0-20210407085831-115137ce5a22/store/storetest/storetest.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 3 /* 4 * Copyright (C) 2014-2018 Canonical Ltd 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 3 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package storetest 21 22 import ( 23 "context" 24 "io" 25 26 "github.com/snapcore/snapd/asserts" 27 "github.com/snapcore/snapd/client" 28 "github.com/snapcore/snapd/overlord/auth" 29 "github.com/snapcore/snapd/overlord/snapstate" 30 "github.com/snapcore/snapd/progress" 31 "github.com/snapcore/snapd/snap" 32 "github.com/snapcore/snapd/store" 33 ) 34 35 // Store implements a snapstate.StoreService where every single method panics. 36 // 37 // Embed in your own fakeStore to avoid having to keep up with that interface's 38 // evolution when it's unrelated to your code. 39 type Store struct{} 40 41 // ensure we conform 42 var _ snapstate.StoreService = Store{} 43 44 func (Store) EnsureDeviceSession() (*auth.DeviceState, error) { 45 panic("Store.EnsureDeviceSession not expected") 46 } 47 48 func (Store) SnapInfo(context.Context, store.SnapSpec, *auth.UserState) (*snap.Info, error) { 49 panic("Store.SnapInfo not expected") 50 } 51 52 func (Store) Find(context.Context, *store.Search, *auth.UserState) ([]*snap.Info, error) { 53 panic("Store.Find not expected") 54 } 55 56 func (Store) SnapAction(context.Context, []*store.CurrentSnap, []*store.SnapAction, store.AssertionQuery, *auth.UserState, *store.RefreshOptions) ([]store.SnapActionResult, []store.AssertionResult, error) { 57 panic("Store.SnapAction not expected") 58 } 59 60 func (Store) Download(context.Context, string, string, *snap.DownloadInfo, progress.Meter, *auth.UserState, *store.DownloadOptions) error { 61 panic("Store.Download not expected") 62 } 63 64 func (Store) DownloadStream(ctx context.Context, name string, downloadInfo *snap.DownloadInfo, resume int64, user *auth.UserState) (io.ReadCloser, int, error) { 65 panic("Store.DownloadStream not expected") 66 } 67 68 func (Store) SuggestedCurrency() string { 69 panic("Store.SuggestedCurrency not expected") 70 } 71 72 func (Store) Buy(*client.BuyOptions, *auth.UserState) (*client.BuyResult, error) { 73 panic("Store.Buy not expected") 74 } 75 76 func (Store) ReadyToBuy(*auth.UserState) error { 77 panic("Store.ReadyToBuy not expected") 78 } 79 80 func (Store) Sections(context.Context, *auth.UserState) ([]string, error) { 81 panic("Store.Sections not expected") 82 } 83 84 func (Store) Assertion(*asserts.AssertionType, []string, *auth.UserState) (asserts.Assertion, error) { 85 panic("Store.Assertion not expected") 86 } 87 88 func (Store) SeqFormingAssertion(*asserts.AssertionType, []string, int, *auth.UserState) (asserts.Assertion, error) { 89 panic("Store.SeqFormingAssertion not expected") 90 } 91 92 func (Store) DownloadAssertions([]string, *asserts.Batch, *auth.UserState) error { 93 panic("Store.DownloadAssertions not expected") 94 } 95 96 func (Store) WriteCatalogs(context.Context, io.Writer, store.SnapAdder) error { 97 panic("fakeStore.WriteCatalogs not expected") 98 } 99 100 func (Store) ConnectivityCheck() (map[string]bool, error) { 101 panic("ConnectivityCheck not expected") 102 } 103 104 func (Store) CreateCohorts(context.Context, []string) (map[string]string, error) { 105 panic("CreateCohort not expected") 106 } 107 108 func (Store) LoginUser(username, password, otp string) (string, string, error) { 109 panic("LoginUser not expected") 110 } 111 112 func (Store) UserInfo(email string) (userinfo *store.User, err error) { 113 panic("UserInfo not expected") 114 }