github.com/meulengracht/snapd@v0.0.0-20210719210640-8bde69bcc84e/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/snap/channel"
    33  	"github.com/snapcore/snapd/snap/naming"
    34  	"github.com/snapcore/snapd/store"
    35  )
    36  
    37  // Store implements a snapstate.StoreService where every single method panics.
    38  //
    39  // Embed in your own fakeStore to avoid having to keep up with that interface's
    40  // evolution when it's unrelated to your code.
    41  type Store struct{}
    42  
    43  // ensure we conform
    44  var _ snapstate.StoreService = Store{}
    45  
    46  func (Store) EnsureDeviceSession() (*auth.DeviceState, error) {
    47  	panic("Store.EnsureDeviceSession not expected")
    48  }
    49  
    50  func (Store) SnapInfo(context.Context, store.SnapSpec, *auth.UserState) (*snap.Info, error) {
    51  	panic("Store.SnapInfo not expected")
    52  }
    53  
    54  func (Store) SnapExists(context.Context, store.SnapSpec, *auth.UserState) (naming.SnapRef, *channel.Channel, error) {
    55  	panic("Store.SnapExists not expected")
    56  }
    57  
    58  func (Store) Find(context.Context, *store.Search, *auth.UserState) ([]*snap.Info, error) {
    59  	panic("Store.Find not expected")
    60  }
    61  
    62  func (Store) SnapAction(context.Context, []*store.CurrentSnap, []*store.SnapAction, store.AssertionQuery, *auth.UserState, *store.RefreshOptions) ([]store.SnapActionResult, []store.AssertionResult, error) {
    63  	panic("Store.SnapAction not expected")
    64  }
    65  
    66  func (Store) Download(context.Context, string, string, *snap.DownloadInfo, progress.Meter, *auth.UserState, *store.DownloadOptions) error {
    67  	panic("Store.Download not expected")
    68  }
    69  
    70  func (Store) DownloadStream(ctx context.Context, name string, downloadInfo *snap.DownloadInfo, resume int64, user *auth.UserState) (io.ReadCloser, int, error) {
    71  	panic("Store.DownloadStream not expected")
    72  }
    73  
    74  func (Store) SuggestedCurrency() string {
    75  	panic("Store.SuggestedCurrency not expected")
    76  }
    77  
    78  func (Store) Buy(*client.BuyOptions, *auth.UserState) (*client.BuyResult, error) {
    79  	panic("Store.Buy not expected")
    80  }
    81  
    82  func (Store) ReadyToBuy(*auth.UserState) error {
    83  	panic("Store.ReadyToBuy not expected")
    84  }
    85  
    86  func (Store) Sections(context.Context, *auth.UserState) ([]string, error) {
    87  	panic("Store.Sections not expected")
    88  }
    89  
    90  func (Store) Assertion(*asserts.AssertionType, []string, *auth.UserState) (asserts.Assertion, error) {
    91  	panic("Store.Assertion not expected")
    92  }
    93  
    94  func (Store) SeqFormingAssertion(*asserts.AssertionType, []string, int, *auth.UserState) (asserts.Assertion, error) {
    95  	panic("Store.SeqFormingAssertion not expected")
    96  }
    97  
    98  func (Store) DownloadAssertions([]string, *asserts.Batch, *auth.UserState) error {
    99  	panic("Store.DownloadAssertions not expected")
   100  }
   101  
   102  func (Store) WriteCatalogs(context.Context, io.Writer, store.SnapAdder) error {
   103  	panic("fakeStore.WriteCatalogs not expected")
   104  }
   105  
   106  func (Store) ConnectivityCheck() (map[string]bool, error) {
   107  	panic("ConnectivityCheck not expected")
   108  }
   109  
   110  func (Store) CreateCohorts(context.Context, []string) (map[string]string, error) {
   111  	panic("CreateCohort not expected")
   112  }
   113  
   114  func (Store) LoginUser(username, password, otp string) (string, string, error) {
   115  	panic("LoginUser not expected")
   116  }
   117  
   118  func (Store) UserInfo(email string) (userinfo *store.User, err error) {
   119  	panic("UserInfo not expected")
   120  }