github.com/ungtb10d/cli/v2@v2.0.0-20221110210412-98537dd9d6a1/internal/prompter/prompter_mock.go (about)

     1  // Code generated by moq; DO NOT EDIT.
     2  // github.com/matryer/moq
     3  
     4  package prompter
     5  
     6  import (
     7  	"sync"
     8  )
     9  
    10  // Ensure, that PrompterMock does implement Prompter.
    11  // If this is not the case, regenerate this file with moq.
    12  var _ Prompter = &PrompterMock{}
    13  
    14  // PrompterMock is a mock implementation of Prompter.
    15  //
    16  // 	func TestSomethingThatUsesPrompter(t *testing.T) {
    17  //
    18  // 		// make and configure a mocked Prompter
    19  // 		mockedPrompter := &PrompterMock{
    20  // 			AuthTokenFunc: func() (string, error) {
    21  // 				panic("mock out the AuthToken method")
    22  // 			},
    23  // 			ConfirmFunc: func(s string, b bool) (bool, error) {
    24  // 				panic("mock out the Confirm method")
    25  // 			},
    26  // 			ConfirmDeletionFunc: func(s string) error {
    27  // 				panic("mock out the ConfirmDeletion method")
    28  // 			},
    29  // 			InputFunc: func(s1 string, s2 string) (string, error) {
    30  // 				panic("mock out the Input method")
    31  // 			},
    32  // 			InputHostnameFunc: func() (string, error) {
    33  // 				panic("mock out the InputHostname method")
    34  // 			},
    35  // 			MarkdownEditorFunc: func(s1 string, s2 string, b bool) (string, error) {
    36  // 				panic("mock out the MarkdownEditor method")
    37  // 			},
    38  // 			MultiSelectFunc: func(s1 string, s2 string, strings []string) (int, error) {
    39  // 				panic("mock out the MultiSelect method")
    40  // 			},
    41  // 			PasswordFunc: func(s string) (string, error) {
    42  // 				panic("mock out the Password method")
    43  // 			},
    44  // 			SelectFunc: func(s1 string, s2 string, strings []string) (int, error) {
    45  // 				panic("mock out the Select method")
    46  // 			},
    47  // 		}
    48  //
    49  // 		// use mockedPrompter in code that requires Prompter
    50  // 		// and then make assertions.
    51  //
    52  // 	}
    53  type PrompterMock struct {
    54  	// AuthTokenFunc mocks the AuthToken method.
    55  	AuthTokenFunc func() (string, error)
    56  
    57  	// ConfirmFunc mocks the Confirm method.
    58  	ConfirmFunc func(s string, b bool) (bool, error)
    59  
    60  	// ConfirmDeletionFunc mocks the ConfirmDeletion method.
    61  	ConfirmDeletionFunc func(s string) error
    62  
    63  	// InputFunc mocks the Input method.
    64  	InputFunc func(s1 string, s2 string) (string, error)
    65  
    66  	// InputHostnameFunc mocks the InputHostname method.
    67  	InputHostnameFunc func() (string, error)
    68  
    69  	// MarkdownEditorFunc mocks the MarkdownEditor method.
    70  	MarkdownEditorFunc func(s1 string, s2 string, b bool) (string, error)
    71  
    72  	// MultiSelectFunc mocks the MultiSelect method.
    73  	MultiSelectFunc func(s1 string, s2 string, strings []string) (int, error)
    74  
    75  	// PasswordFunc mocks the Password method.
    76  	PasswordFunc func(s string) (string, error)
    77  
    78  	// SelectFunc mocks the Select method.
    79  	SelectFunc func(s1 string, s2 string, strings []string) (int, error)
    80  
    81  	// calls tracks calls to the methods.
    82  	calls struct {
    83  		// AuthToken holds details about calls to the AuthToken method.
    84  		AuthToken []struct {
    85  		}
    86  		// Confirm holds details about calls to the Confirm method.
    87  		Confirm []struct {
    88  			// S is the s argument value.
    89  			S string
    90  			// B is the b argument value.
    91  			B bool
    92  		}
    93  		// ConfirmDeletion holds details about calls to the ConfirmDeletion method.
    94  		ConfirmDeletion []struct {
    95  			// S is the s argument value.
    96  			S string
    97  		}
    98  		// Input holds details about calls to the Input method.
    99  		Input []struct {
   100  			// S1 is the s1 argument value.
   101  			S1 string
   102  			// S2 is the s2 argument value.
   103  			S2 string
   104  		}
   105  		// InputHostname holds details about calls to the InputHostname method.
   106  		InputHostname []struct {
   107  		}
   108  		// MarkdownEditor holds details about calls to the MarkdownEditor method.
   109  		MarkdownEditor []struct {
   110  			// S1 is the s1 argument value.
   111  			S1 string
   112  			// S2 is the s2 argument value.
   113  			S2 string
   114  			// B is the b argument value.
   115  			B bool
   116  		}
   117  		// MultiSelect holds details about calls to the MultiSelect method.
   118  		MultiSelect []struct {
   119  			// S1 is the s1 argument value.
   120  			S1 string
   121  			// S2 is the s2 argument value.
   122  			S2 string
   123  			// Strings is the strings argument value.
   124  			Strings []string
   125  		}
   126  		// Password holds details about calls to the Password method.
   127  		Password []struct {
   128  			// S is the s argument value.
   129  			S string
   130  		}
   131  		// Select holds details about calls to the Select method.
   132  		Select []struct {
   133  			// S1 is the s1 argument value.
   134  			S1 string
   135  			// S2 is the s2 argument value.
   136  			S2 string
   137  			// Strings is the strings argument value.
   138  			Strings []string
   139  		}
   140  	}
   141  	lockAuthToken       sync.RWMutex
   142  	lockConfirm         sync.RWMutex
   143  	lockConfirmDeletion sync.RWMutex
   144  	lockInput           sync.RWMutex
   145  	lockInputHostname   sync.RWMutex
   146  	lockMarkdownEditor  sync.RWMutex
   147  	lockMultiSelect     sync.RWMutex
   148  	lockPassword        sync.RWMutex
   149  	lockSelect          sync.RWMutex
   150  }
   151  
   152  // AuthToken calls AuthTokenFunc.
   153  func (mock *PrompterMock) AuthToken() (string, error) {
   154  	if mock.AuthTokenFunc == nil {
   155  		panic("PrompterMock.AuthTokenFunc: method is nil but Prompter.AuthToken was just called")
   156  	}
   157  	callInfo := struct {
   158  	}{}
   159  	mock.lockAuthToken.Lock()
   160  	mock.calls.AuthToken = append(mock.calls.AuthToken, callInfo)
   161  	mock.lockAuthToken.Unlock()
   162  	return mock.AuthTokenFunc()
   163  }
   164  
   165  // AuthTokenCalls gets all the calls that were made to AuthToken.
   166  // Check the length with:
   167  //     len(mockedPrompter.AuthTokenCalls())
   168  func (mock *PrompterMock) AuthTokenCalls() []struct {
   169  } {
   170  	var calls []struct {
   171  	}
   172  	mock.lockAuthToken.RLock()
   173  	calls = mock.calls.AuthToken
   174  	mock.lockAuthToken.RUnlock()
   175  	return calls
   176  }
   177  
   178  // Confirm calls ConfirmFunc.
   179  func (mock *PrompterMock) Confirm(s string, b bool) (bool, error) {
   180  	if mock.ConfirmFunc == nil {
   181  		panic("PrompterMock.ConfirmFunc: method is nil but Prompter.Confirm was just called")
   182  	}
   183  	callInfo := struct {
   184  		S string
   185  		B bool
   186  	}{
   187  		S: s,
   188  		B: b,
   189  	}
   190  	mock.lockConfirm.Lock()
   191  	mock.calls.Confirm = append(mock.calls.Confirm, callInfo)
   192  	mock.lockConfirm.Unlock()
   193  	return mock.ConfirmFunc(s, b)
   194  }
   195  
   196  // ConfirmCalls gets all the calls that were made to Confirm.
   197  // Check the length with:
   198  //     len(mockedPrompter.ConfirmCalls())
   199  func (mock *PrompterMock) ConfirmCalls() []struct {
   200  	S string
   201  	B bool
   202  } {
   203  	var calls []struct {
   204  		S string
   205  		B bool
   206  	}
   207  	mock.lockConfirm.RLock()
   208  	calls = mock.calls.Confirm
   209  	mock.lockConfirm.RUnlock()
   210  	return calls
   211  }
   212  
   213  // ConfirmDeletion calls ConfirmDeletionFunc.
   214  func (mock *PrompterMock) ConfirmDeletion(s string) error {
   215  	if mock.ConfirmDeletionFunc == nil {
   216  		panic("PrompterMock.ConfirmDeletionFunc: method is nil but Prompter.ConfirmDeletion was just called")
   217  	}
   218  	callInfo := struct {
   219  		S string
   220  	}{
   221  		S: s,
   222  	}
   223  	mock.lockConfirmDeletion.Lock()
   224  	mock.calls.ConfirmDeletion = append(mock.calls.ConfirmDeletion, callInfo)
   225  	mock.lockConfirmDeletion.Unlock()
   226  	return mock.ConfirmDeletionFunc(s)
   227  }
   228  
   229  // ConfirmDeletionCalls gets all the calls that were made to ConfirmDeletion.
   230  // Check the length with:
   231  //     len(mockedPrompter.ConfirmDeletionCalls())
   232  func (mock *PrompterMock) ConfirmDeletionCalls() []struct {
   233  	S string
   234  } {
   235  	var calls []struct {
   236  		S string
   237  	}
   238  	mock.lockConfirmDeletion.RLock()
   239  	calls = mock.calls.ConfirmDeletion
   240  	mock.lockConfirmDeletion.RUnlock()
   241  	return calls
   242  }
   243  
   244  // Input calls InputFunc.
   245  func (mock *PrompterMock) Input(s1 string, s2 string) (string, error) {
   246  	if mock.InputFunc == nil {
   247  		panic("PrompterMock.InputFunc: method is nil but Prompter.Input was just called")
   248  	}
   249  	callInfo := struct {
   250  		S1 string
   251  		S2 string
   252  	}{
   253  		S1: s1,
   254  		S2: s2,
   255  	}
   256  	mock.lockInput.Lock()
   257  	mock.calls.Input = append(mock.calls.Input, callInfo)
   258  	mock.lockInput.Unlock()
   259  	return mock.InputFunc(s1, s2)
   260  }
   261  
   262  // InputCalls gets all the calls that were made to Input.
   263  // Check the length with:
   264  //     len(mockedPrompter.InputCalls())
   265  func (mock *PrompterMock) InputCalls() []struct {
   266  	S1 string
   267  	S2 string
   268  } {
   269  	var calls []struct {
   270  		S1 string
   271  		S2 string
   272  	}
   273  	mock.lockInput.RLock()
   274  	calls = mock.calls.Input
   275  	mock.lockInput.RUnlock()
   276  	return calls
   277  }
   278  
   279  // InputHostname calls InputHostnameFunc.
   280  func (mock *PrompterMock) InputHostname() (string, error) {
   281  	if mock.InputHostnameFunc == nil {
   282  		panic("PrompterMock.InputHostnameFunc: method is nil but Prompter.InputHostname was just called")
   283  	}
   284  	callInfo := struct {
   285  	}{}
   286  	mock.lockInputHostname.Lock()
   287  	mock.calls.InputHostname = append(mock.calls.InputHostname, callInfo)
   288  	mock.lockInputHostname.Unlock()
   289  	return mock.InputHostnameFunc()
   290  }
   291  
   292  // InputHostnameCalls gets all the calls that were made to InputHostname.
   293  // Check the length with:
   294  //     len(mockedPrompter.InputHostnameCalls())
   295  func (mock *PrompterMock) InputHostnameCalls() []struct {
   296  } {
   297  	var calls []struct {
   298  	}
   299  	mock.lockInputHostname.RLock()
   300  	calls = mock.calls.InputHostname
   301  	mock.lockInputHostname.RUnlock()
   302  	return calls
   303  }
   304  
   305  // MarkdownEditor calls MarkdownEditorFunc.
   306  func (mock *PrompterMock) MarkdownEditor(s1 string, s2 string, b bool) (string, error) {
   307  	if mock.MarkdownEditorFunc == nil {
   308  		panic("PrompterMock.MarkdownEditorFunc: method is nil but Prompter.MarkdownEditor was just called")
   309  	}
   310  	callInfo := struct {
   311  		S1 string
   312  		S2 string
   313  		B  bool
   314  	}{
   315  		S1: s1,
   316  		S2: s2,
   317  		B:  b,
   318  	}
   319  	mock.lockMarkdownEditor.Lock()
   320  	mock.calls.MarkdownEditor = append(mock.calls.MarkdownEditor, callInfo)
   321  	mock.lockMarkdownEditor.Unlock()
   322  	return mock.MarkdownEditorFunc(s1, s2, b)
   323  }
   324  
   325  // MarkdownEditorCalls gets all the calls that were made to MarkdownEditor.
   326  // Check the length with:
   327  //     len(mockedPrompter.MarkdownEditorCalls())
   328  func (mock *PrompterMock) MarkdownEditorCalls() []struct {
   329  	S1 string
   330  	S2 string
   331  	B  bool
   332  } {
   333  	var calls []struct {
   334  		S1 string
   335  		S2 string
   336  		B  bool
   337  	}
   338  	mock.lockMarkdownEditor.RLock()
   339  	calls = mock.calls.MarkdownEditor
   340  	mock.lockMarkdownEditor.RUnlock()
   341  	return calls
   342  }
   343  
   344  // MultiSelect calls MultiSelectFunc.
   345  func (mock *PrompterMock) MultiSelect(s1 string, s2 string, strings []string) (int, error) {
   346  	if mock.MultiSelectFunc == nil {
   347  		panic("PrompterMock.MultiSelectFunc: method is nil but Prompter.MultiSelect was just called")
   348  	}
   349  	callInfo := struct {
   350  		S1      string
   351  		S2      string
   352  		Strings []string
   353  	}{
   354  		S1:      s1,
   355  		S2:      s2,
   356  		Strings: strings,
   357  	}
   358  	mock.lockMultiSelect.Lock()
   359  	mock.calls.MultiSelect = append(mock.calls.MultiSelect, callInfo)
   360  	mock.lockMultiSelect.Unlock()
   361  	return mock.MultiSelectFunc(s1, s2, strings)
   362  }
   363  
   364  // MultiSelectCalls gets all the calls that were made to MultiSelect.
   365  // Check the length with:
   366  //     len(mockedPrompter.MultiSelectCalls())
   367  func (mock *PrompterMock) MultiSelectCalls() []struct {
   368  	S1      string
   369  	S2      string
   370  	Strings []string
   371  } {
   372  	var calls []struct {
   373  		S1      string
   374  		S2      string
   375  		Strings []string
   376  	}
   377  	mock.lockMultiSelect.RLock()
   378  	calls = mock.calls.MultiSelect
   379  	mock.lockMultiSelect.RUnlock()
   380  	return calls
   381  }
   382  
   383  // Password calls PasswordFunc.
   384  func (mock *PrompterMock) Password(s string) (string, error) {
   385  	if mock.PasswordFunc == nil {
   386  		panic("PrompterMock.PasswordFunc: method is nil but Prompter.Password was just called")
   387  	}
   388  	callInfo := struct {
   389  		S string
   390  	}{
   391  		S: s,
   392  	}
   393  	mock.lockPassword.Lock()
   394  	mock.calls.Password = append(mock.calls.Password, callInfo)
   395  	mock.lockPassword.Unlock()
   396  	return mock.PasswordFunc(s)
   397  }
   398  
   399  // PasswordCalls gets all the calls that were made to Password.
   400  // Check the length with:
   401  //     len(mockedPrompter.PasswordCalls())
   402  func (mock *PrompterMock) PasswordCalls() []struct {
   403  	S string
   404  } {
   405  	var calls []struct {
   406  		S string
   407  	}
   408  	mock.lockPassword.RLock()
   409  	calls = mock.calls.Password
   410  	mock.lockPassword.RUnlock()
   411  	return calls
   412  }
   413  
   414  // Select calls SelectFunc.
   415  func (mock *PrompterMock) Select(s1 string, s2 string, strings []string) (int, error) {
   416  	if mock.SelectFunc == nil {
   417  		panic("PrompterMock.SelectFunc: method is nil but Prompter.Select was just called")
   418  	}
   419  	callInfo := struct {
   420  		S1      string
   421  		S2      string
   422  		Strings []string
   423  	}{
   424  		S1:      s1,
   425  		S2:      s2,
   426  		Strings: strings,
   427  	}
   428  	mock.lockSelect.Lock()
   429  	mock.calls.Select = append(mock.calls.Select, callInfo)
   430  	mock.lockSelect.Unlock()
   431  	return mock.SelectFunc(s1, s2, strings)
   432  }
   433  
   434  // SelectCalls gets all the calls that were made to Select.
   435  // Check the length with:
   436  //     len(mockedPrompter.SelectCalls())
   437  func (mock *PrompterMock) SelectCalls() []struct {
   438  	S1      string
   439  	S2      string
   440  	Strings []string
   441  } {
   442  	var calls []struct {
   443  		S1      string
   444  		S2      string
   445  		Strings []string
   446  	}
   447  	mock.lockSelect.RLock()
   448  	calls = mock.calls.Select
   449  	mock.lockSelect.RUnlock()
   450  	return calls
   451  }