-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mark Laing <mark.laing@canonical.com>
- Loading branch information
1 parent
ef64133
commit bb9eecd
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package gomaasapi | ||
|
||
import ( | ||
"github.com/juju/testing" | ||
jc "github.com/juju/testing/checkers" | ||
gc "gopkg.in/check.v1" | ||
) | ||
|
||
type tagSuite struct { | ||
testing.LoggingCleanupSuite | ||
} | ||
|
||
var _ = gc.Suite(&tagSuite{}) | ||
|
||
func (*tagSuite) TestReadTags(c *gc.C) { | ||
tags, err := readTags(twoDotOh, parseJSON(c, tagsResponse)) | ||
c.Assert(err, jc.ErrorIsNil) | ||
c.Assert(tags, gc.HasLen, 3) | ||
|
||
tag := tags[0] | ||
|
||
c.Check(tag.Name(), gc.Equals, "virtual") | ||
c.Check(tag.Comment(), gc.Equals, "virtual machines") | ||
c.Check(tag.Definition(), gc.Equals, "tag for machines that are virtual") | ||
c.Check(tag.KernelOpts(), gc.Equals, "nvme_core") | ||
} | ||
|
||
var tagsResponse = `[ | ||
{ | ||
"resource_uri": "/2.0/tags/virtual", | ||
"name": "virtual", | ||
"comment": "virtual machines", | ||
"definition": "tag for machines that are virtual", | ||
"kernel_opts": "nvme_core" | ||
}, | ||
{ | ||
"resource_uri": "/2.0/tags/physical", | ||
"name": "physical", | ||
"comment": "physical machines", | ||
"definition": "tag for machines that are physical", | ||
"kernel_opts": "" | ||
}, | ||
{ | ||
"resource_uri": "/2.0/tags/r-pi", | ||
"name": "r-pi", | ||
"comment": "raspberry pis'", | ||
"definition": "tag for machines that are raspberry pis", | ||
"kernel_opts": "" | ||
} | ||
]` |