Skip to content

Commit

Permalink
Add test case for create schedule job
Browse files Browse the repository at this point in the history
  • Loading branch information
jensoncs committed Jan 17, 2019
1 parent 3af408b commit 714ae41
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cmd/schedule/create/create_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package create

import (
"testing"

"github.com/gojektech/proctor/daemon"
"github.com/gojektech/proctor/io"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)

type ScheduleCreateCmdTestSuite struct {
suite.Suite
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleCreateCmd *cobra.Command
}

func (s *ScheduleCreateCmdTestSuite) SetupTest() {
s.mockPrinter = &io.MockPrinter{}
s.mockProctorDClient = &daemon.MockClient{}
s.testScheduleCreateCmd = NewCmd(s.mockPrinter, s.mockProctorDClient)
}

func (s *ScheduleCreateCmdTestSuite) TestScheduleCreateCmdHelp() {
assert.Equal(s.T(), "Create scheduled jobs", s.testScheduleCreateCmd.Short)
assert.Equal(s.T(), "This command helps to create scheduled jobs", s.testScheduleCreateCmd.Long)
assert.Equal(s.T(), "proctor schedule create run-sample -t '0 2 * * *' -n 'username@mail.com' -T 'sample,proctor' ARG_ONE1=foobar", s.testScheduleCreateCmd.Example)
}

func TestScheduleCreateCmdTestSuite(t *testing.T) {
suite.Run(t, new(ScheduleCreateCmdTestSuite))
}

0 comments on commit 714ae41

Please sign in to comment.