...

Source file src/github.com/go-kivik/kivik/v4/mockdb/clientexpectations_gen.go

Documentation: github.com/go-kivik/kivik/v4/mockdb

     1  /* This file is auto-generated. Do not edit it! */
     2  
     3  package mockdb
     4  
     5  import (
     6  	"context"
     7  	"fmt"
     8  	"reflect"
     9  	"time"
    10  
    11  	kivik "github.com/go-kivik/kivik/v4"
    12  	"github.com/go-kivik/kivik/v4/driver"
    13  )
    14  
    15  var _ = &driver.Attachment{}
    16  var _ = reflect.Int
    17  
    18  // ExpectedAllDBs represents an expectation for a call to AllDBs().
    19  type ExpectedAllDBs struct {
    20  	commonExpectation
    21  	callback func(ctx context.Context, options driver.Options) ([]string, error)
    22  	ret0     []string
    23  }
    24  
    25  // WithOptions sets the expected options for the call to AllDBs().
    26  func (e *ExpectedAllDBs) WithOptions(options ...kivik.Option) *ExpectedAllDBs {
    27  	e.options = multiOptions{e.options, multiOptions(options)}
    28  	return e
    29  }
    30  
    31  // WillExecute sets a callback function to be called with any inputs to the
    32  // original function. Any values returned by the callback will be returned as
    33  // if generated by the driver.
    34  func (e *ExpectedAllDBs) WillExecute(cb func(ctx context.Context, options driver.Options) ([]string, error)) *ExpectedAllDBs {
    35  	e.callback = cb
    36  	return e
    37  }
    38  
    39  // WillReturn sets the values that will be returned by the call to AllDBs().
    40  func (e *ExpectedAllDBs) WillReturn(ret0 []string) *ExpectedAllDBs {
    41  	e.ret0 = ret0
    42  	return e
    43  }
    44  
    45  // WillReturnError sets the error value that will be returned by the call to AllDBs().
    46  func (e *ExpectedAllDBs) WillReturnError(err error) *ExpectedAllDBs {
    47  	e.err = err
    48  	return e
    49  }
    50  
    51  // WillDelay causes the call to AllDBs() to delay.
    52  func (e *ExpectedAllDBs) WillDelay(delay time.Duration) *ExpectedAllDBs {
    53  	e.delay = delay
    54  	return e
    55  }
    56  
    57  func (e *ExpectedAllDBs) met(_ expectation) bool {
    58  	return true
    59  }
    60  
    61  func (e *ExpectedAllDBs) method(v bool) string {
    62  	if !v {
    63  		return "AllDBs()"
    64  	}
    65  	options := formatOptions(e.options)
    66  	return fmt.Sprintf("AllDBs(ctx, %s)", options)
    67  }
    68  
    69  // ExpectedClose represents an expectation for a call to Close().
    70  type ExpectedClose struct {
    71  	commonExpectation
    72  	callback func() error
    73  }
    74  
    75  // WillExecute sets a callback function to be called with any inputs to the
    76  // original function. Any values returned by the callback will be returned as
    77  // if generated by the driver.
    78  func (e *ExpectedClose) WillExecute(cb func() error) *ExpectedClose {
    79  	e.callback = cb
    80  	return e
    81  }
    82  
    83  // WillReturnError sets the error value that will be returned by the call to Close().
    84  func (e *ExpectedClose) WillReturnError(err error) *ExpectedClose {
    85  	e.err = err
    86  	return e
    87  }
    88  
    89  func (e *ExpectedClose) met(_ expectation) bool {
    90  	return true
    91  }
    92  
    93  func (e *ExpectedClose) method(v bool) string {
    94  	if !v {
    95  		return "Close()"
    96  	}
    97  	return fmt.Sprintf("Close()")
    98  }
    99  
   100  // ExpectedClusterSetup represents an expectation for a call to ClusterSetup().
   101  type ExpectedClusterSetup struct {
   102  	commonExpectation
   103  	callback func(ctx context.Context, arg0 interface{}) error
   104  	arg0     interface{}
   105  }
   106  
   107  // WillExecute sets a callback function to be called with any inputs to the
   108  // original function. Any values returned by the callback will be returned as
   109  // if generated by the driver.
   110  func (e *ExpectedClusterSetup) WillExecute(cb func(ctx context.Context, arg0 interface{}) error) *ExpectedClusterSetup {
   111  	e.callback = cb
   112  	return e
   113  }
   114  
   115  // WillReturnError sets the error value that will be returned by the call to ClusterSetup().
   116  func (e *ExpectedClusterSetup) WillReturnError(err error) *ExpectedClusterSetup {
   117  	e.err = err
   118  	return e
   119  }
   120  
   121  // WillDelay causes the call to ClusterSetup() to delay.
   122  func (e *ExpectedClusterSetup) WillDelay(delay time.Duration) *ExpectedClusterSetup {
   123  	e.delay = delay
   124  	return e
   125  }
   126  
   127  func (e *ExpectedClusterSetup) met(ex expectation) bool {
   128  	exp := ex.(*ExpectedClusterSetup)
   129  	if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) {
   130  		return false
   131  	}
   132  	return true
   133  }
   134  
   135  func (e *ExpectedClusterSetup) method(v bool) string {
   136  	if !v {
   137  		return "ClusterSetup()"
   138  	}
   139  	arg0 := "?"
   140  	if e.arg0 != nil {
   141  		arg0 = fmt.Sprintf("%v", e.arg0)
   142  	}
   143  	return fmt.Sprintf("ClusterSetup(ctx, %s)", arg0)
   144  }
   145  
   146  // ExpectedClusterStatus represents an expectation for a call to ClusterStatus().
   147  type ExpectedClusterStatus struct {
   148  	commonExpectation
   149  	callback func(ctx context.Context, options driver.Options) (string, error)
   150  	ret0     string
   151  }
   152  
   153  // WithOptions sets the expected options for the call to ClusterStatus().
   154  func (e *ExpectedClusterStatus) WithOptions(options ...kivik.Option) *ExpectedClusterStatus {
   155  	e.options = multiOptions{e.options, multiOptions(options)}
   156  	return e
   157  }
   158  
   159  // WillExecute sets a callback function to be called with any inputs to the
   160  // original function. Any values returned by the callback will be returned as
   161  // if generated by the driver.
   162  func (e *ExpectedClusterStatus) WillExecute(cb func(ctx context.Context, options driver.Options) (string, error)) *ExpectedClusterStatus {
   163  	e.callback = cb
   164  	return e
   165  }
   166  
   167  // WillReturn sets the values that will be returned by the call to ClusterStatus().
   168  func (e *ExpectedClusterStatus) WillReturn(ret0 string) *ExpectedClusterStatus {
   169  	e.ret0 = ret0
   170  	return e
   171  }
   172  
   173  // WillReturnError sets the error value that will be returned by the call to ClusterStatus().
   174  func (e *ExpectedClusterStatus) WillReturnError(err error) *ExpectedClusterStatus {
   175  	e.err = err
   176  	return e
   177  }
   178  
   179  // WillDelay causes the call to ClusterStatus() to delay.
   180  func (e *ExpectedClusterStatus) WillDelay(delay time.Duration) *ExpectedClusterStatus {
   181  	e.delay = delay
   182  	return e
   183  }
   184  
   185  func (e *ExpectedClusterStatus) met(_ expectation) bool {
   186  	return true
   187  }
   188  
   189  func (e *ExpectedClusterStatus) method(v bool) string {
   190  	if !v {
   191  		return "ClusterStatus()"
   192  	}
   193  	options := formatOptions(e.options)
   194  	return fmt.Sprintf("ClusterStatus(ctx, %s)", options)
   195  }
   196  
   197  // ExpectedConfigValue represents an expectation for a call to ConfigValue().
   198  type ExpectedConfigValue struct {
   199  	commonExpectation
   200  	callback func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)
   201  	arg0     string
   202  	arg1     string
   203  	arg2     string
   204  	ret0     string
   205  }
   206  
   207  // WillExecute sets a callback function to be called with any inputs to the
   208  // original function. Any values returned by the callback will be returned as
   209  // if generated by the driver.
   210  func (e *ExpectedConfigValue) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)) *ExpectedConfigValue {
   211  	e.callback = cb
   212  	return e
   213  }
   214  
   215  // WillReturn sets the values that will be returned by the call to ConfigValue().
   216  func (e *ExpectedConfigValue) WillReturn(ret0 string) *ExpectedConfigValue {
   217  	e.ret0 = ret0
   218  	return e
   219  }
   220  
   221  // WillReturnError sets the error value that will be returned by the call to ConfigValue().
   222  func (e *ExpectedConfigValue) WillReturnError(err error) *ExpectedConfigValue {
   223  	e.err = err
   224  	return e
   225  }
   226  
   227  // WillDelay causes the call to ConfigValue() to delay.
   228  func (e *ExpectedConfigValue) WillDelay(delay time.Duration) *ExpectedConfigValue {
   229  	e.delay = delay
   230  	return e
   231  }
   232  
   233  func (e *ExpectedConfigValue) met(ex expectation) bool {
   234  	exp := ex.(*ExpectedConfigValue)
   235  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
   236  		return false
   237  	}
   238  	if exp.arg1 != "" && exp.arg1 != e.arg1 {
   239  		return false
   240  	}
   241  	if exp.arg2 != "" && exp.arg2 != e.arg2 {
   242  		return false
   243  	}
   244  	return true
   245  }
   246  
   247  func (e *ExpectedConfigValue) method(v bool) string {
   248  	if !v {
   249  		return "ConfigValue()"
   250  	}
   251  	arg0, arg1, arg2 := "?", "?", "?"
   252  	if e.arg0 != "" {
   253  		arg0 = fmt.Sprintf("%q", e.arg0)
   254  	}
   255  	if e.arg1 != "" {
   256  		arg1 = fmt.Sprintf("%q", e.arg1)
   257  	}
   258  	if e.arg2 != "" {
   259  		arg2 = fmt.Sprintf("%q", e.arg2)
   260  	}
   261  	return fmt.Sprintf("ConfigValue(ctx, %s, %s, %s)", arg0, arg1, arg2)
   262  }
   263  
   264  // ExpectedDBExists represents an expectation for a call to DBExists().
   265  type ExpectedDBExists struct {
   266  	commonExpectation
   267  	callback func(ctx context.Context, arg0 string, options driver.Options) (bool, error)
   268  	arg0     string
   269  	ret0     bool
   270  }
   271  
   272  // WithOptions sets the expected options for the call to DBExists().
   273  func (e *ExpectedDBExists) WithOptions(options ...kivik.Option) *ExpectedDBExists {
   274  	e.options = multiOptions{e.options, multiOptions(options)}
   275  	return e
   276  }
   277  
   278  // WillExecute sets a callback function to be called with any inputs to the
   279  // original function. Any values returned by the callback will be returned as
   280  // if generated by the driver.
   281  func (e *ExpectedDBExists) WillExecute(cb func(ctx context.Context, arg0 string, options driver.Options) (bool, error)) *ExpectedDBExists {
   282  	e.callback = cb
   283  	return e
   284  }
   285  
   286  // WillReturn sets the values that will be returned by the call to DBExists().
   287  func (e *ExpectedDBExists) WillReturn(ret0 bool) *ExpectedDBExists {
   288  	e.ret0 = ret0
   289  	return e
   290  }
   291  
   292  // WillReturnError sets the error value that will be returned by the call to DBExists().
   293  func (e *ExpectedDBExists) WillReturnError(err error) *ExpectedDBExists {
   294  	e.err = err
   295  	return e
   296  }
   297  
   298  // WillDelay causes the call to DBExists() to delay.
   299  func (e *ExpectedDBExists) WillDelay(delay time.Duration) *ExpectedDBExists {
   300  	e.delay = delay
   301  	return e
   302  }
   303  
   304  func (e *ExpectedDBExists) met(ex expectation) bool {
   305  	exp := ex.(*ExpectedDBExists)
   306  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
   307  		return false
   308  	}
   309  	return true
   310  }
   311  
   312  func (e *ExpectedDBExists) method(v bool) string {
   313  	if !v {
   314  		return "DBExists()"
   315  	}
   316  	arg0, options := "?", formatOptions(e.options)
   317  	if e.arg0 != "" {
   318  		arg0 = fmt.Sprintf("%q", e.arg0)
   319  	}
   320  	return fmt.Sprintf("DBExists(ctx, %s, %s)", arg0, options)
   321  }
   322  
   323  // ExpectedDeleteConfigKey represents an expectation for a call to DeleteConfigKey().
   324  type ExpectedDeleteConfigKey struct {
   325  	commonExpectation
   326  	callback func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)
   327  	arg0     string
   328  	arg1     string
   329  	arg2     string
   330  	ret0     string
   331  }
   332  
   333  // WillExecute sets a callback function to be called with any inputs to the
   334  // original function. Any values returned by the callback will be returned as
   335  // if generated by the driver.
   336  func (e *ExpectedDeleteConfigKey) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)) *ExpectedDeleteConfigKey {
   337  	e.callback = cb
   338  	return e
   339  }
   340  
   341  // WillReturn sets the values that will be returned by the call to DeleteConfigKey().
   342  func (e *ExpectedDeleteConfigKey) WillReturn(ret0 string) *ExpectedDeleteConfigKey {
   343  	e.ret0 = ret0
   344  	return e
   345  }
   346  
   347  // WillReturnError sets the error value that will be returned by the call to DeleteConfigKey().
   348  func (e *ExpectedDeleteConfigKey) WillReturnError(err error) *ExpectedDeleteConfigKey {
   349  	e.err = err
   350  	return e
   351  }
   352  
   353  // WillDelay causes the call to DeleteConfigKey() to delay.
   354  func (e *ExpectedDeleteConfigKey) WillDelay(delay time.Duration) *ExpectedDeleteConfigKey {
   355  	e.delay = delay
   356  	return e
   357  }
   358  
   359  func (e *ExpectedDeleteConfigKey) met(ex expectation) bool {
   360  	exp := ex.(*ExpectedDeleteConfigKey)
   361  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
   362  		return false
   363  	}
   364  	if exp.arg1 != "" && exp.arg1 != e.arg1 {
   365  		return false
   366  	}
   367  	if exp.arg2 != "" && exp.arg2 != e.arg2 {
   368  		return false
   369  	}
   370  	return true
   371  }
   372  
   373  func (e *ExpectedDeleteConfigKey) method(v bool) string {
   374  	if !v {
   375  		return "DeleteConfigKey()"
   376  	}
   377  	arg0, arg1, arg2 := "?", "?", "?"
   378  	if e.arg0 != "" {
   379  		arg0 = fmt.Sprintf("%q", e.arg0)
   380  	}
   381  	if e.arg1 != "" {
   382  		arg1 = fmt.Sprintf("%q", e.arg1)
   383  	}
   384  	if e.arg2 != "" {
   385  		arg2 = fmt.Sprintf("%q", e.arg2)
   386  	}
   387  	return fmt.Sprintf("DeleteConfigKey(ctx, %s, %s, %s)", arg0, arg1, arg2)
   388  }
   389  
   390  // ExpectedDestroyDB represents an expectation for a call to DestroyDB().
   391  type ExpectedDestroyDB struct {
   392  	commonExpectation
   393  	callback func(ctx context.Context, arg0 string, options driver.Options) error
   394  	arg0     string
   395  }
   396  
   397  // WithOptions sets the expected options for the call to DestroyDB().
   398  func (e *ExpectedDestroyDB) WithOptions(options ...kivik.Option) *ExpectedDestroyDB {
   399  	e.options = multiOptions{e.options, multiOptions(options)}
   400  	return e
   401  }
   402  
   403  // WillExecute sets a callback function to be called with any inputs to the
   404  // original function. Any values returned by the callback will be returned as
   405  // if generated by the driver.
   406  func (e *ExpectedDestroyDB) WillExecute(cb func(ctx context.Context, arg0 string, options driver.Options) error) *ExpectedDestroyDB {
   407  	e.callback = cb
   408  	return e
   409  }
   410  
   411  // WillReturnError sets the error value that will be returned by the call to DestroyDB().
   412  func (e *ExpectedDestroyDB) WillReturnError(err error) *ExpectedDestroyDB {
   413  	e.err = err
   414  	return e
   415  }
   416  
   417  // WillDelay causes the call to DestroyDB() to delay.
   418  func (e *ExpectedDestroyDB) WillDelay(delay time.Duration) *ExpectedDestroyDB {
   419  	e.delay = delay
   420  	return e
   421  }
   422  
   423  func (e *ExpectedDestroyDB) met(ex expectation) bool {
   424  	exp := ex.(*ExpectedDestroyDB)
   425  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
   426  		return false
   427  	}
   428  	return true
   429  }
   430  
   431  func (e *ExpectedDestroyDB) method(v bool) string {
   432  	if !v {
   433  		return "DestroyDB()"
   434  	}
   435  	arg0, options := "?", formatOptions(e.options)
   436  	if e.arg0 != "" {
   437  		arg0 = fmt.Sprintf("%q", e.arg0)
   438  	}
   439  	return fmt.Sprintf("DestroyDB(ctx, %s, %s)", arg0, options)
   440  }
   441  
   442  // ExpectedPing represents an expectation for a call to Ping().
   443  type ExpectedPing struct {
   444  	commonExpectation
   445  	callback func(ctx context.Context) (bool, error)
   446  	ret0     bool
   447  }
   448  
   449  // WillExecute sets a callback function to be called with any inputs to the
   450  // original function. Any values returned by the callback will be returned as
   451  // if generated by the driver.
   452  func (e *ExpectedPing) WillExecute(cb func(ctx context.Context) (bool, error)) *ExpectedPing {
   453  	e.callback = cb
   454  	return e
   455  }
   456  
   457  // WillReturn sets the values that will be returned by the call to Ping().
   458  func (e *ExpectedPing) WillReturn(ret0 bool) *ExpectedPing {
   459  	e.ret0 = ret0
   460  	return e
   461  }
   462  
   463  // WillReturnError sets the error value that will be returned by the call to Ping().
   464  func (e *ExpectedPing) WillReturnError(err error) *ExpectedPing {
   465  	e.err = err
   466  	return e
   467  }
   468  
   469  // WillDelay causes the call to Ping() to delay.
   470  func (e *ExpectedPing) WillDelay(delay time.Duration) *ExpectedPing {
   471  	e.delay = delay
   472  	return e
   473  }
   474  
   475  func (e *ExpectedPing) met(_ expectation) bool {
   476  	return true
   477  }
   478  
   479  func (e *ExpectedPing) method(v bool) string {
   480  	if !v {
   481  		return "Ping()"
   482  	}
   483  	return fmt.Sprintf("Ping(ctx)")
   484  }
   485  
   486  // ExpectedSetConfigValue represents an expectation for a call to SetConfigValue().
   487  type ExpectedSetConfigValue struct {
   488  	commonExpectation
   489  	callback func(ctx context.Context, arg0 string, arg1 string, arg2 string, arg3 string) (string, error)
   490  	arg0     string
   491  	arg1     string
   492  	arg2     string
   493  	arg3     string
   494  	ret0     string
   495  }
   496  
   497  // WillExecute sets a callback function to be called with any inputs to the
   498  // original function. Any values returned by the callback will be returned as
   499  // if generated by the driver.
   500  func (e *ExpectedSetConfigValue) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string, arg3 string) (string, error)) *ExpectedSetConfigValue {
   501  	e.callback = cb
   502  	return e
   503  }
   504  
   505  // WillReturn sets the values that will be returned by the call to SetConfigValue().
   506  func (e *ExpectedSetConfigValue) WillReturn(ret0 string) *ExpectedSetConfigValue {
   507  	e.ret0 = ret0
   508  	return e
   509  }
   510  
   511  // WillReturnError sets the error value that will be returned by the call to SetConfigValue().
   512  func (e *ExpectedSetConfigValue) WillReturnError(err error) *ExpectedSetConfigValue {
   513  	e.err = err
   514  	return e
   515  }
   516  
   517  // WillDelay causes the call to SetConfigValue() to delay.
   518  func (e *ExpectedSetConfigValue) WillDelay(delay time.Duration) *ExpectedSetConfigValue {
   519  	e.delay = delay
   520  	return e
   521  }
   522  
   523  func (e *ExpectedSetConfigValue) met(ex expectation) bool {
   524  	exp := ex.(*ExpectedSetConfigValue)
   525  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
   526  		return false
   527  	}
   528  	if exp.arg1 != "" && exp.arg1 != e.arg1 {
   529  		return false
   530  	}
   531  	if exp.arg2 != "" && exp.arg2 != e.arg2 {
   532  		return false
   533  	}
   534  	if exp.arg3 != "" && exp.arg3 != e.arg3 {
   535  		return false
   536  	}
   537  	return true
   538  }
   539  
   540  func (e *ExpectedSetConfigValue) method(v bool) string {
   541  	if !v {
   542  		return "SetConfigValue()"
   543  	}
   544  	arg0, arg1, arg2, arg3 := "?", "?", "?", "?"
   545  	if e.arg0 != "" {
   546  		arg0 = fmt.Sprintf("%q", e.arg0)
   547  	}
   548  	if e.arg1 != "" {
   549  		arg1 = fmt.Sprintf("%q", e.arg1)
   550  	}
   551  	if e.arg2 != "" {
   552  		arg2 = fmt.Sprintf("%q", e.arg2)
   553  	}
   554  	if e.arg3 != "" {
   555  		arg3 = fmt.Sprintf("%q", e.arg3)
   556  	}
   557  	return fmt.Sprintf("SetConfigValue(ctx, %s, %s, %s, %s)", arg0, arg1, arg2, arg3)
   558  }
   559  
   560  // ExpectedAllDBsStats represents an expectation for a call to AllDBsStats().
   561  type ExpectedAllDBsStats struct {
   562  	commonExpectation
   563  	callback func(ctx context.Context, options driver.Options) ([]*driver.DBStats, error)
   564  	ret0     []*driver.DBStats
   565  }
   566  
   567  // WithOptions sets the expected options for the call to AllDBsStats().
   568  func (e *ExpectedAllDBsStats) WithOptions(options ...kivik.Option) *ExpectedAllDBsStats {
   569  	e.options = multiOptions{e.options, multiOptions(options)}
   570  	return e
   571  }
   572  
   573  // WillExecute sets a callback function to be called with any inputs to the
   574  // original function. Any values returned by the callback will be returned as
   575  // if generated by the driver.
   576  func (e *ExpectedAllDBsStats) WillExecute(cb func(ctx context.Context, options driver.Options) ([]*driver.DBStats, error)) *ExpectedAllDBsStats {
   577  	e.callback = cb
   578  	return e
   579  }
   580  
   581  // WillReturn sets the values that will be returned by the call to AllDBsStats().
   582  func (e *ExpectedAllDBsStats) WillReturn(ret0 []*driver.DBStats) *ExpectedAllDBsStats {
   583  	e.ret0 = ret0
   584  	return e
   585  }
   586  
   587  // WillReturnError sets the error value that will be returned by the call to AllDBsStats().
   588  func (e *ExpectedAllDBsStats) WillReturnError(err error) *ExpectedAllDBsStats {
   589  	e.err = err
   590  	return e
   591  }
   592  
   593  // WillDelay causes the call to AllDBsStats() to delay.
   594  func (e *ExpectedAllDBsStats) WillDelay(delay time.Duration) *ExpectedAllDBsStats {
   595  	e.delay = delay
   596  	return e
   597  }
   598  
   599  func (e *ExpectedAllDBsStats) met(_ expectation) bool {
   600  	return true
   601  }
   602  
   603  func (e *ExpectedAllDBsStats) method(v bool) string {
   604  	if !v {
   605  		return "AllDBsStats()"
   606  	}
   607  	options := formatOptions(e.options)
   608  	return fmt.Sprintf("AllDBsStats(ctx, %s)", options)
   609  }
   610  
   611  // ExpectedConfig represents an expectation for a call to Config().
   612  type ExpectedConfig struct {
   613  	commonExpectation
   614  	callback func(ctx context.Context, arg0 string) (driver.Config, error)
   615  	arg0     string
   616  	ret0     driver.Config
   617  }
   618  
   619  // WillExecute sets a callback function to be called with any inputs to the
   620  // original function. Any values returned by the callback will be returned as
   621  // if generated by the driver.
   622  func (e *ExpectedConfig) WillExecute(cb func(ctx context.Context, arg0 string) (driver.Config, error)) *ExpectedConfig {
   623  	e.callback = cb
   624  	return e
   625  }
   626  
   627  // WillReturn sets the values that will be returned by the call to Config().
   628  func (e *ExpectedConfig) WillReturn(ret0 driver.Config) *ExpectedConfig {
   629  	e.ret0 = ret0
   630  	return e
   631  }
   632  
   633  // WillReturnError sets the error value that will be returned by the call to Config().
   634  func (e *ExpectedConfig) WillReturnError(err error) *ExpectedConfig {
   635  	e.err = err
   636  	return e
   637  }
   638  
   639  // WillDelay causes the call to Config() to delay.
   640  func (e *ExpectedConfig) WillDelay(delay time.Duration) *ExpectedConfig {
   641  	e.delay = delay
   642  	return e
   643  }
   644  
   645  func (e *ExpectedConfig) met(ex expectation) bool {
   646  	exp := ex.(*ExpectedConfig)
   647  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
   648  		return false
   649  	}
   650  	return true
   651  }
   652  
   653  func (e *ExpectedConfig) method(v bool) string {
   654  	if !v {
   655  		return "Config()"
   656  	}
   657  	arg0 := "?"
   658  	if e.arg0 != "" {
   659  		arg0 = fmt.Sprintf("%q", e.arg0)
   660  	}
   661  	return fmt.Sprintf("Config(ctx, %s)", arg0)
   662  }
   663  
   664  // ExpectedConfigSection represents an expectation for a call to ConfigSection().
   665  type ExpectedConfigSection struct {
   666  	commonExpectation
   667  	callback func(ctx context.Context, arg0 string, arg1 string) (driver.ConfigSection, error)
   668  	arg0     string
   669  	arg1     string
   670  	ret0     driver.ConfigSection
   671  }
   672  
   673  // WillExecute sets a callback function to be called with any inputs to the
   674  // original function. Any values returned by the callback will be returned as
   675  // if generated by the driver.
   676  func (e *ExpectedConfigSection) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string) (driver.ConfigSection, error)) *ExpectedConfigSection {
   677  	e.callback = cb
   678  	return e
   679  }
   680  
   681  // WillReturn sets the values that will be returned by the call to ConfigSection().
   682  func (e *ExpectedConfigSection) WillReturn(ret0 driver.ConfigSection) *ExpectedConfigSection {
   683  	e.ret0 = ret0
   684  	return e
   685  }
   686  
   687  // WillReturnError sets the error value that will be returned by the call to ConfigSection().
   688  func (e *ExpectedConfigSection) WillReturnError(err error) *ExpectedConfigSection {
   689  	e.err = err
   690  	return e
   691  }
   692  
   693  // WillDelay causes the call to ConfigSection() to delay.
   694  func (e *ExpectedConfigSection) WillDelay(delay time.Duration) *ExpectedConfigSection {
   695  	e.delay = delay
   696  	return e
   697  }
   698  
   699  func (e *ExpectedConfigSection) met(ex expectation) bool {
   700  	exp := ex.(*ExpectedConfigSection)
   701  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
   702  		return false
   703  	}
   704  	if exp.arg1 != "" && exp.arg1 != e.arg1 {
   705  		return false
   706  	}
   707  	return true
   708  }
   709  
   710  func (e *ExpectedConfigSection) method(v bool) string {
   711  	if !v {
   712  		return "ConfigSection()"
   713  	}
   714  	arg0, arg1 := "?", "?"
   715  	if e.arg0 != "" {
   716  		arg0 = fmt.Sprintf("%q", e.arg0)
   717  	}
   718  	if e.arg1 != "" {
   719  		arg1 = fmt.Sprintf("%q", e.arg1)
   720  	}
   721  	return fmt.Sprintf("ConfigSection(ctx, %s, %s)", arg0, arg1)
   722  }
   723  
   724  // ExpectedDB represents an expectation for a call to DB().
   725  type ExpectedDB struct {
   726  	commonExpectation
   727  	callback func(arg0 string, options driver.Options) (driver.DB, error)
   728  	arg0     string
   729  	ret0     *DB
   730  }
   731  
   732  // WithOptions sets the expected options for the call to DB().
   733  func (e *ExpectedDB) WithOptions(options ...kivik.Option) *ExpectedDB {
   734  	e.options = multiOptions{e.options, multiOptions(options)}
   735  	return e
   736  }
   737  
   738  // WillExecute sets a callback function to be called with any inputs to the
   739  // original function. Any values returned by the callback will be returned as
   740  // if generated by the driver.
   741  func (e *ExpectedDB) WillExecute(cb func(arg0 string, options driver.Options) (driver.DB, error)) *ExpectedDB {
   742  	e.callback = cb
   743  	return e
   744  }
   745  
   746  // WillReturn sets the values that will be returned by the call to DB().
   747  func (e *ExpectedDB) WillReturn(ret0 *DB) *ExpectedDB {
   748  	e.ret0 = ret0
   749  	return e
   750  }
   751  
   752  // WillReturnError sets the error value that will be returned by the call to DB().
   753  func (e *ExpectedDB) WillReturnError(err error) *ExpectedDB {
   754  	e.err = err
   755  	return e
   756  }
   757  
   758  func (e *ExpectedDB) met(ex expectation) bool {
   759  	exp := ex.(*ExpectedDB)
   760  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
   761  		return false
   762  	}
   763  	return true
   764  }
   765  
   766  func (e *ExpectedDB) method(v bool) string {
   767  	if !v {
   768  		return "DB()"
   769  	}
   770  	arg0, options := "?", formatOptions(e.options)
   771  	if e.arg0 != "" {
   772  		arg0 = fmt.Sprintf("%q", e.arg0)
   773  	}
   774  	return fmt.Sprintf("DB(%s, %s)", arg0, options)
   775  }
   776  
   777  // ExpectedDBUpdates represents an expectation for a call to DBUpdates().
   778  type ExpectedDBUpdates struct {
   779  	commonExpectation
   780  	callback func(ctx context.Context, options driver.Options) (driver.DBUpdates, error)
   781  	ret0     *Updates
   782  }
   783  
   784  // WithOptions sets the expected options for the call to DBUpdates().
   785  func (e *ExpectedDBUpdates) WithOptions(options ...kivik.Option) *ExpectedDBUpdates {
   786  	e.options = multiOptions{e.options, multiOptions(options)}
   787  	return e
   788  }
   789  
   790  // WillExecute sets a callback function to be called with any inputs to the
   791  // original function. Any values returned by the callback will be returned as
   792  // if generated by the driver.
   793  func (e *ExpectedDBUpdates) WillExecute(cb func(ctx context.Context, options driver.Options) (driver.DBUpdates, error)) *ExpectedDBUpdates {
   794  	e.callback = cb
   795  	return e
   796  }
   797  
   798  // WillReturn sets the values that will be returned by the call to DBUpdates().
   799  func (e *ExpectedDBUpdates) WillReturn(ret0 *Updates) *ExpectedDBUpdates {
   800  	e.ret0 = ret0
   801  	return e
   802  }
   803  
   804  // WillReturnError sets the error value that will be returned by the call to DBUpdates().
   805  func (e *ExpectedDBUpdates) WillReturnError(err error) *ExpectedDBUpdates {
   806  	e.err = err
   807  	return e
   808  }
   809  
   810  // WillDelay causes the call to DBUpdates() to delay.
   811  func (e *ExpectedDBUpdates) WillDelay(delay time.Duration) *ExpectedDBUpdates {
   812  	e.delay = delay
   813  	return e
   814  }
   815  
   816  func (e *ExpectedDBUpdates) met(_ expectation) bool {
   817  	return true
   818  }
   819  
   820  func (e *ExpectedDBUpdates) method(v bool) string {
   821  	if !v {
   822  		return "DBUpdates()"
   823  	}
   824  	options := formatOptions(e.options)
   825  	return fmt.Sprintf("DBUpdates(ctx, %s)", options)
   826  }
   827  
   828  // ExpectedDBsStats represents an expectation for a call to DBsStats().
   829  type ExpectedDBsStats struct {
   830  	commonExpectation
   831  	callback func(ctx context.Context, arg0 []string) ([]*driver.DBStats, error)
   832  	arg0     []string
   833  	ret0     []*driver.DBStats
   834  }
   835  
   836  // WillExecute sets a callback function to be called with any inputs to the
   837  // original function. Any values returned by the callback will be returned as
   838  // if generated by the driver.
   839  func (e *ExpectedDBsStats) WillExecute(cb func(ctx context.Context, arg0 []string) ([]*driver.DBStats, error)) *ExpectedDBsStats {
   840  	e.callback = cb
   841  	return e
   842  }
   843  
   844  // WillReturn sets the values that will be returned by the call to DBsStats().
   845  func (e *ExpectedDBsStats) WillReturn(ret0 []*driver.DBStats) *ExpectedDBsStats {
   846  	e.ret0 = ret0
   847  	return e
   848  }
   849  
   850  // WillReturnError sets the error value that will be returned by the call to DBsStats().
   851  func (e *ExpectedDBsStats) WillReturnError(err error) *ExpectedDBsStats {
   852  	e.err = err
   853  	return e
   854  }
   855  
   856  // WillDelay causes the call to DBsStats() to delay.
   857  func (e *ExpectedDBsStats) WillDelay(delay time.Duration) *ExpectedDBsStats {
   858  	e.delay = delay
   859  	return e
   860  }
   861  
   862  func (e *ExpectedDBsStats) met(ex expectation) bool {
   863  	exp := ex.(*ExpectedDBsStats)
   864  	if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) {
   865  		return false
   866  	}
   867  	return true
   868  }
   869  
   870  func (e *ExpectedDBsStats) method(v bool) string {
   871  	if !v {
   872  		return "DBsStats()"
   873  	}
   874  	arg0 := "?"
   875  	if e.arg0 != nil {
   876  		arg0 = fmt.Sprintf("%v", e.arg0)
   877  	}
   878  	return fmt.Sprintf("DBsStats(ctx, %s)", arg0)
   879  }
   880  
   881  // ExpectedGetReplications represents an expectation for a call to GetReplications().
   882  type ExpectedGetReplications struct {
   883  	commonExpectation
   884  	callback func(ctx context.Context, options driver.Options) ([]driver.Replication, error)
   885  	ret0     []*Replication
   886  }
   887  
   888  // WithOptions sets the expected options for the call to GetReplications().
   889  func (e *ExpectedGetReplications) WithOptions(options ...kivik.Option) *ExpectedGetReplications {
   890  	e.options = multiOptions{e.options, multiOptions(options)}
   891  	return e
   892  }
   893  
   894  // WillExecute sets a callback function to be called with any inputs to the
   895  // original function. Any values returned by the callback will be returned as
   896  // if generated by the driver.
   897  func (e *ExpectedGetReplications) WillExecute(cb func(ctx context.Context, options driver.Options) ([]driver.Replication, error)) *ExpectedGetReplications {
   898  	e.callback = cb
   899  	return e
   900  }
   901  
   902  // WillReturn sets the values that will be returned by the call to GetReplications().
   903  func (e *ExpectedGetReplications) WillReturn(ret0 []*Replication) *ExpectedGetReplications {
   904  	e.ret0 = ret0
   905  	return e
   906  }
   907  
   908  // WillReturnError sets the error value that will be returned by the call to GetReplications().
   909  func (e *ExpectedGetReplications) WillReturnError(err error) *ExpectedGetReplications {
   910  	e.err = err
   911  	return e
   912  }
   913  
   914  // WillDelay causes the call to GetReplications() to delay.
   915  func (e *ExpectedGetReplications) WillDelay(delay time.Duration) *ExpectedGetReplications {
   916  	e.delay = delay
   917  	return e
   918  }
   919  
   920  func (e *ExpectedGetReplications) met(_ expectation) bool {
   921  	return true
   922  }
   923  
   924  func (e *ExpectedGetReplications) method(v bool) string {
   925  	if !v {
   926  		return "GetReplications()"
   927  	}
   928  	options := formatOptions(e.options)
   929  	return fmt.Sprintf("GetReplications(ctx, %s)", options)
   930  }
   931  
   932  // ExpectedMembership represents an expectation for a call to Membership().
   933  type ExpectedMembership struct {
   934  	commonExpectation
   935  	callback func(ctx context.Context) (*driver.ClusterMembership, error)
   936  	ret0     *driver.ClusterMembership
   937  }
   938  
   939  // WillExecute sets a callback function to be called with any inputs to the
   940  // original function. Any values returned by the callback will be returned as
   941  // if generated by the driver.
   942  func (e *ExpectedMembership) WillExecute(cb func(ctx context.Context) (*driver.ClusterMembership, error)) *ExpectedMembership {
   943  	e.callback = cb
   944  	return e
   945  }
   946  
   947  // WillReturn sets the values that will be returned by the call to Membership().
   948  func (e *ExpectedMembership) WillReturn(ret0 *driver.ClusterMembership) *ExpectedMembership {
   949  	e.ret0 = ret0
   950  	return e
   951  }
   952  
   953  // WillReturnError sets the error value that will be returned by the call to Membership().
   954  func (e *ExpectedMembership) WillReturnError(err error) *ExpectedMembership {
   955  	e.err = err
   956  	return e
   957  }
   958  
   959  // WillDelay causes the call to Membership() to delay.
   960  func (e *ExpectedMembership) WillDelay(delay time.Duration) *ExpectedMembership {
   961  	e.delay = delay
   962  	return e
   963  }
   964  
   965  func (e *ExpectedMembership) met(_ expectation) bool {
   966  	return true
   967  }
   968  
   969  func (e *ExpectedMembership) method(v bool) string {
   970  	if !v {
   971  		return "Membership()"
   972  	}
   973  	return fmt.Sprintf("Membership(ctx)")
   974  }
   975  
   976  // ExpectedReplicate represents an expectation for a call to Replicate().
   977  type ExpectedReplicate struct {
   978  	commonExpectation
   979  	callback func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (driver.Replication, error)
   980  	arg0     string
   981  	arg1     string
   982  	ret0     *Replication
   983  }
   984  
   985  // WithOptions sets the expected options for the call to Replicate().
   986  func (e *ExpectedReplicate) WithOptions(options ...kivik.Option) *ExpectedReplicate {
   987  	e.options = multiOptions{e.options, multiOptions(options)}
   988  	return e
   989  }
   990  
   991  // WillExecute sets a callback function to be called with any inputs to the
   992  // original function. Any values returned by the callback will be returned as
   993  // if generated by the driver.
   994  func (e *ExpectedReplicate) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (driver.Replication, error)) *ExpectedReplicate {
   995  	e.callback = cb
   996  	return e
   997  }
   998  
   999  // WillReturn sets the values that will be returned by the call to Replicate().
  1000  func (e *ExpectedReplicate) WillReturn(ret0 *Replication) *ExpectedReplicate {
  1001  	e.ret0 = ret0
  1002  	return e
  1003  }
  1004  
  1005  // WillReturnError sets the error value that will be returned by the call to Replicate().
  1006  func (e *ExpectedReplicate) WillReturnError(err error) *ExpectedReplicate {
  1007  	e.err = err
  1008  	return e
  1009  }
  1010  
  1011  // WillDelay causes the call to Replicate() to delay.
  1012  func (e *ExpectedReplicate) WillDelay(delay time.Duration) *ExpectedReplicate {
  1013  	e.delay = delay
  1014  	return e
  1015  }
  1016  
  1017  func (e *ExpectedReplicate) met(ex expectation) bool {
  1018  	exp := ex.(*ExpectedReplicate)
  1019  	if exp.arg0 != "" && exp.arg0 != e.arg0 {
  1020  		return false
  1021  	}
  1022  	if exp.arg1 != "" && exp.arg1 != e.arg1 {
  1023  		return false
  1024  	}
  1025  	return true
  1026  }
  1027  
  1028  func (e *ExpectedReplicate) method(v bool) string {
  1029  	if !v {
  1030  		return "Replicate()"
  1031  	}
  1032  	arg0, arg1, options := "?", "?", formatOptions(e.options)
  1033  	if e.arg0 != "" {
  1034  		arg0 = fmt.Sprintf("%q", e.arg0)
  1035  	}
  1036  	if e.arg1 != "" {
  1037  		arg1 = fmt.Sprintf("%q", e.arg1)
  1038  	}
  1039  	return fmt.Sprintf("Replicate(ctx, %s, %s, %s)", arg0, arg1, options)
  1040  }
  1041  
  1042  // ExpectedSession represents an expectation for a call to Session().
  1043  type ExpectedSession struct {
  1044  	commonExpectation
  1045  	callback func(ctx context.Context) (*driver.Session, error)
  1046  	ret0     *driver.Session
  1047  }
  1048  
  1049  // WillExecute sets a callback function to be called with any inputs to the
  1050  // original function. Any values returned by the callback will be returned as
  1051  // if generated by the driver.
  1052  func (e *ExpectedSession) WillExecute(cb func(ctx context.Context) (*driver.Session, error)) *ExpectedSession {
  1053  	e.callback = cb
  1054  	return e
  1055  }
  1056  
  1057  // WillReturn sets the values that will be returned by the call to Session().
  1058  func (e *ExpectedSession) WillReturn(ret0 *driver.Session) *ExpectedSession {
  1059  	e.ret0 = ret0
  1060  	return e
  1061  }
  1062  
  1063  // WillReturnError sets the error value that will be returned by the call to Session().
  1064  func (e *ExpectedSession) WillReturnError(err error) *ExpectedSession {
  1065  	e.err = err
  1066  	return e
  1067  }
  1068  
  1069  // WillDelay causes the call to Session() to delay.
  1070  func (e *ExpectedSession) WillDelay(delay time.Duration) *ExpectedSession {
  1071  	e.delay = delay
  1072  	return e
  1073  }
  1074  
  1075  func (e *ExpectedSession) met(_ expectation) bool {
  1076  	return true
  1077  }
  1078  
  1079  func (e *ExpectedSession) method(v bool) string {
  1080  	if !v {
  1081  		return "Session()"
  1082  	}
  1083  	return fmt.Sprintf("Session(ctx)")
  1084  }
  1085  
  1086  // ExpectedVersion represents an expectation for a call to Version().
  1087  type ExpectedVersion struct {
  1088  	commonExpectation
  1089  	callback func(ctx context.Context) (*driver.Version, error)
  1090  	ret0     *driver.Version
  1091  }
  1092  
  1093  // WillExecute sets a callback function to be called with any inputs to the
  1094  // original function. Any values returned by the callback will be returned as
  1095  // if generated by the driver.
  1096  func (e *ExpectedVersion) WillExecute(cb func(ctx context.Context) (*driver.Version, error)) *ExpectedVersion {
  1097  	e.callback = cb
  1098  	return e
  1099  }
  1100  
  1101  // WillReturn sets the values that will be returned by the call to Version().
  1102  func (e *ExpectedVersion) WillReturn(ret0 *driver.Version) *ExpectedVersion {
  1103  	e.ret0 = ret0
  1104  	return e
  1105  }
  1106  
  1107  // WillReturnError sets the error value that will be returned by the call to Version().
  1108  func (e *ExpectedVersion) WillReturnError(err error) *ExpectedVersion {
  1109  	e.err = err
  1110  	return e
  1111  }
  1112  
  1113  // WillDelay causes the call to Version() to delay.
  1114  func (e *ExpectedVersion) WillDelay(delay time.Duration) *ExpectedVersion {
  1115  	e.delay = delay
  1116  	return e
  1117  }
  1118  
  1119  func (e *ExpectedVersion) met(_ expectation) bool {
  1120  	return true
  1121  }
  1122  
  1123  func (e *ExpectedVersion) method(v bool) string {
  1124  	if !v {
  1125  		return "Version()"
  1126  	}
  1127  	return fmt.Sprintf("Version(ctx)")
  1128  }
  1129  

View as plain text