Skip to content

Commit

Permalink
Ensure submit prints on success
Browse files Browse the repository at this point in the history
  • Loading branch information
jdsutherland committed Jan 2, 2019
1 parent 8a9c2f3 commit c686c3c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cmd/submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func TestSubmitFiles(t *testing.T) {
co := newCapturedOutput()
co.override()
defer co.reset()
Err = &bytes.Buffer{}

// The fake endpoint will populate this when it receives the call from the command.
submittedFiles := map[string]string{}
Expand Down Expand Up @@ -186,14 +187,16 @@ func TestSubmitFiles(t *testing.T) {
files := []string{
file1, file2, readme,
}
err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), files)
assert.NoError(t, err)

assert.Equal(t, 3, len(submittedFiles))
err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), files)

assert.Equal(t, "This is file 1.", submittedFiles["file-1.txt"])
assert.Equal(t, "This is file 2.", submittedFiles["subdir/file-2.txt"])
assert.Equal(t, "This is the readme.", submittedFiles["README.md"])
if assert.NoError(t, err) {
assert.Equal(t, 3, len(submittedFiles))
assert.Equal(t, "This is file 1.", submittedFiles["file-1.txt"])
assert.Equal(t, "This is file 2.", submittedFiles["subdir/file-2.txt"])
assert.Equal(t, "This is the readme.", submittedFiles["README.md"])
assert.Regexp(t, "submitted successfully", Err)
}
}

func TestLegacyMetadataMigration(t *testing.T) {
Expand Down

0 comments on commit c686c3c

Please sign in to comment.