github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/cli/commands/resources/project/import_mock.go (about)

     1  //go:build mockGithub
     2  // +build mockGithub
     3  
     4  package project
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/google/go-github/v53/github"
    10  	commonTest "github.com/taubyte/tau-cli/common/test"
    11  )
    12  
    13  // TODO: If tests are run using go run . rather than building cli, then this can be avoided
    14  var (
    15  	configId           int64 = 1234
    16  	codeId             int64 = 5678
    17  	configRepoName           = "tb_Repo"
    18  	configRepoFullName       = commonTest.GitUser + "/" + configRepoName
    19  	codeRepoName             = "tb_code_Repo"
    20  	codeRepoFullName         = commonTest.GitUser + "/" + codeRepoName
    21  
    22  	mockConfigRepo = &github.Repository{
    23  		ID:       &configId,
    24  		Name:     &configRepoName,
    25  		FullName: &configRepoFullName,
    26  	}
    27  
    28  	mockCodeRepo = &github.Repository{
    29  		ID:       &codeId,
    30  		Name:     &codeRepoName,
    31  		FullName: &codeRepoFullName,
    32  	}
    33  )
    34  
    35  // used for tests
    36  func init() {
    37  	ListRepos = func(ctx context.Context, token, user string) ([]*github.Repository, error) {
    38  		return []*github.Repository{
    39  			mockConfigRepo,
    40  			mockCodeRepo,
    41  		}, nil
    42  	}
    43  }