Skip to content
Permalink
Browse files

Fix CLI get_project subcommand to use proto.MarshalToTextString (like…

… surrounding code) instead of .String()

PiperOrigin-RevId: 282674681
Change-Id: Ic1f3e89af6be840b3eaad2ccd959b70afdbd30bf
  • Loading branch information
timford committed Nov 27, 2019
1 parent 9a017f8 commit 48483b544b1d4ba0899c4a5d8add36f6886f17a4
Showing with 24 additions and 3 deletions.
  1. +1 −1 cli/lib.go
  2. +23 −2 cli/lib_test.go
@@ -1031,7 +1031,7 @@ func getProject(ctx context.Context, s mako.Storage) (subcommands.ExitStatus, er
if err != nil {
return subcommands.ExitFailure, err
}
fmt.Fprint(outWriter, gr.GetProjectInfo().String())
fmt.Fprint(outWriter, proto.MarshalTextString(gr.GetProjectInfo()))
return subcommands.ExitSuccess, nil
}

@@ -714,7 +714,17 @@ default_issue_tracker: {
`
projFilePath := writeTextProto(textProto, "test_project")
checkCmdLineSucceeded(ctx, t, []string{"mako", "create_project", projFilePath}, `Successfully created project.`)
checkCmdLineSucceeded(ctx, t, []string{"mako", "get_project", "-project_name=bigtable"}, `project_name:"bigtable" project_alias:"Bigtable" owner_list:"mako@prod.google.com" owner_list:"user@google.com" default_issue_tracker:{buganizer_config:{component_id:"123456789"}}`)
checkCmdLineSucceeded(ctx, t, []string{"mako", "get_project", "-project_name=bigtable"},
`project_name: "bigtable"
project_alias: "Bigtable"
owner_list: "mako@prod.google.com"
owner_list: "user@google.com"
default_issue_tracker: <
buganizer_config: <
component_id: "123456789"
>
>
`)

textProto = `
# project_name is always evaluated as lowercase and must be unique
@@ -739,7 +749,18 @@ default_issue_tracker: {
`
projFilePath = writeTextProto(textProto, "test_project")
checkCmdLineSucceeded(ctx, t, []string{"mako", "update_project", projFilePath}, `Successfully updated project.`)
checkCmdLineSucceeded(ctx, t, []string{"mako", "get_project", "-project_name=BIGTABLE"}, `project_name:"bigtable" project_alias:"Spanner Bigtable" owner_list:"user@google.com" owner_list:"mako@prod.google.com" owner_list:"spanner@prod.google.com" default_issue_tracker:{buganizer_config:{component_id:"987654321"}}`)
checkCmdLineSucceeded(ctx, t, []string{"mako", "get_project", "-project_name=BIGTABLE"},
`project_name: "bigtable"
project_alias: "Spanner Bigtable"
owner_list: "user@google.com"
owner_list:"mako@prod.google.com"
owner_list: "spanner@prod.google.com"
default_issue_tracker: <
buganizer_config: <
component_id: "987654321"
>
>
`)
}

func readRunFilesFile(name string) ([]byte, error) {

0 comments on commit 48483b5

Please sign in to comment.
You can’t perform that action at this time.