tests: Add cli.Context helper functions

Created two new helper functions to create a `cli.Context` with and without a
`cli.App`.

Calling these functions simplifies a lot of test code.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt
2018-08-09 14:15:07 +01:00
parent 41d1c14c68
commit 0ede467256
19 changed files with 147 additions and 214 deletions

View File

@@ -21,7 +21,7 @@ func TestSpecCliAction(t *testing.T) {
assert.True(ok)
flagSet := flag.NewFlagSet("flag", flag.ContinueOnError)
ctx := cli.NewContext(&cli.App{}, flagSet, nil)
ctx := createCLIContext(flagSet)
defer os.Remove(specConfig)
err := actionFunc(ctx)
assert.NoError(err)