-
Notifications
You must be signed in to change notification settings - Fork 36
/
filesystem_test.go
53 lines (46 loc) · 1.32 KB
/
filesystem_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2016 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package gomaasapi
import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
)
type filesystemSuite struct{}
var _ = gc.Suite(&filesystemSuite{})
func (*filesystemSuite) TestParse2_0(c *gc.C) {
source := map[string]interface{}{
"fstype": "ext4",
"mount_point": "/",
"label": "root",
"uuid": "fake-uuid",
}
fs, err := filesystem2_0(source)
c.Assert(err, jc.ErrorIsNil)
c.Check(fs.Type(), gc.Equals, "ext4")
c.Check(fs.MountPoint(), gc.Equals, "/")
c.Check(fs.Label(), gc.Equals, "root")
c.Check(fs.UUID(), gc.Equals, "fake-uuid")
}
func (*filesystemSuite) TestParse2_Defaults(c *gc.C) {
source := map[string]interface{}{
"fstype": "ext4",
"mount_point": nil,
"label": nil,
"uuid": "fake-uuid",
}
fs, err := filesystem2_0(source)
c.Assert(err, jc.ErrorIsNil)
c.Check(fs.Type(), gc.Equals, "ext4")
c.Check(fs.MountPoint(), gc.Equals, "")
c.Check(fs.Label(), gc.Equals, "")
c.Check(fs.UUID(), gc.Equals, "fake-uuid")
}
func (*filesystemSuite) TestParse2_0BadSchema(c *gc.C) {
source := map[string]interface{}{
"mount_point": "/",
"label": "root",
"uuid": "fake-uuid",
}
_, err := filesystem2_0(source)
c.Assert(err, jc.Satisfies, IsDeserializationError)
}