github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/kbpagesconfig/utils_test.go (about)

     1  // Copyright 2018 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  type fakePrompterForTest struct {
     8  	nextResponse <-chan string
     9  	prompts      chan<- string
    10  }
    11  
    12  func (p *fakePrompterForTest) Prompt(prompt string) (string, error) {
    13  	if p.prompts != nil {
    14  		p.prompts <- prompt
    15  	}
    16  	return <-p.nextResponse, nil
    17  }
    18  
    19  func (p *fakePrompterForTest) PromptPassword(prompt string) (string, error) {
    20  	if p.prompts != nil {
    21  		p.prompts <- prompt
    22  	}
    23  	return <-p.nextResponse, nil
    24  }