mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-06 07:54:22 +01:00
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:
@@ -31,10 +31,9 @@ func TestVersion(t *testing.T) {
|
||||
return testAppVersion
|
||||
}
|
||||
|
||||
app := cli.NewApp()
|
||||
ctx := cli.NewContext(app, nil, nil)
|
||||
app.Name = testAppName
|
||||
app.Version = runtimeVersion()
|
||||
ctx := createCLIContext(nil)
|
||||
ctx.App.Name = testAppName
|
||||
ctx.App.Version = runtimeVersion()
|
||||
|
||||
fn, ok := versionCLICommand.Action.(func(context *cli.Context) error)
|
||||
assert.True(t, ok)
|
||||
|
||||
Reference in New Issue
Block a user