Skip to content

Commit

Permalink
command output
Browse files Browse the repository at this point in the history
  • Loading branch information
mina1460 committed Jul 20, 2023
1 parent a77263a commit 33ecd37
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/jimmctl/cmd/purgelogs_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cmd_test

import (
"bytes"

"github.com/juju/cmd/v3/cmdtesting"
gc "gopkg.in/check.v1"

Expand All @@ -17,8 +19,11 @@ func (s *purgeLogsSuite) TestPurgeLogsSuperuser(c *gc.C) {
// alice is superuser
bClient := s.userBakeryClient("alice")
datastring := "2021-01-01T00:00:00Z"
_, err := cmdtesting.RunCommand(c, cmd.NewPurgeLogsCommandForTesting(s.ClientStore(), bClient), datastring)
cmdCtx, err := cmdtesting.RunCommand(c, cmd.NewPurgeLogsCommandForTesting(s.ClientStore(), bClient), datastring)
c.Assert(err, gc.IsNil)
expected := "Deleted 0 logs\n"
actual := cmdCtx.Stdout.(*bytes.Buffer).String()
c.Assert(actual, gc.Equals, expected)
}

func (s *purgeLogsSuite) TestInvalidISO8601Date(c *gc.C) {
Expand All @@ -27,6 +32,7 @@ func (s *purgeLogsSuite) TestInvalidISO8601Date(c *gc.C) {
datastring := "13/01/2021"
_, err := cmdtesting.RunCommand(c, cmd.NewPurgeLogsCommandForTesting(s.ClientStore(), bClient), datastring)
c.Assert(err, gc.ErrorMatches, `invalid date. Expected ISO8601 date`)

}

func (s *purgeLogsSuite) TestPurgeLogs(c *gc.C) {
Expand Down

0 comments on commit 33ecd37

Please sign in to comment.