github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/core/lxdprofile/status_test.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package lxdprofile_test
     5  
     6  import (
     7  	"github.com/juju/testing"
     8  	gc "gopkg.in/check.v1"
     9  
    10  	"github.com/juju/juju/core/lxdprofile"
    11  )
    12  
    13  type LXDProfileStatusSuite struct {
    14  	testing.IsolationSuite
    15  }
    16  
    17  var _ = gc.Suite(&LXDProfileStatusSuite{})
    18  
    19  func (*LXDProfileStatusSuite) TestUpgradeStatusFinished(c *gc.C) {
    20  	testCases := []struct {
    21  		input  string
    22  		output bool
    23  	}{
    24  		{
    25  			input:  "",
    26  			output: false,
    27  		},
    28  		{
    29  			input:  lxdprofile.SuccessStatus,
    30  			output: true,
    31  		},
    32  		{
    33  			input:  lxdprofile.NotRequiredStatus,
    34  			output: true,
    35  		},
    36  		{
    37  			input:  lxdprofile.NotSupportedStatus,
    38  			output: true,
    39  		},
    40  		{
    41  			input:  lxdprofile.NotKnownStatus,
    42  			output: false,
    43  		},
    44  		{
    45  			input:  lxdprofile.ErrorStatus,
    46  			output: false,
    47  		},
    48  	}
    49  	for k, tc := range testCases {
    50  		c.Logf("running test %d with input %q", k, tc.input)
    51  		c.Assert(lxdprofile.UpgradeStatusFinished(tc.input), gc.Equals, tc.output)
    52  	}
    53  }
    54  
    55  func (*LXDProfileStatusSuite) TestUpgradeStatusTerminal(c *gc.C) {
    56  	testCases := []struct {
    57  		input  string
    58  		output bool
    59  	}{
    60  		{
    61  			input:  "",
    62  			output: false,
    63  		},
    64  		{
    65  			input:  lxdprofile.SuccessStatus,
    66  			output: true,
    67  		},
    68  		{
    69  			input:  lxdprofile.NotRequiredStatus,
    70  			output: true,
    71  		},
    72  		{
    73  			input:  lxdprofile.NotSupportedStatus,
    74  			output: true,
    75  		},
    76  		{
    77  			input:  lxdprofile.NotKnownStatus,
    78  			output: false,
    79  		},
    80  		{
    81  			input:  lxdprofile.ErrorStatus,
    82  			output: true,
    83  		},
    84  	}
    85  	for k, tc := range testCases {
    86  		c.Logf("running test %d with input %q", k, tc.input)
    87  		c.Assert(lxdprofile.UpgradeStatusTerminal(tc.input), gc.Equals, tc.output)
    88  	}
    89  }