forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_test.go
54 lines (45 loc) · 1.54 KB
/
base_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
54
// Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package backups_test
import (
"time"
gc "gopkg.in/check.v1"
"github.com/juju/juju/api/backups"
"github.com/juju/juju/apiserver/params"
jujutesting "github.com/juju/juju/juju/testing"
stbackups "github.com/juju/juju/state/backups"
backupstesting "github.com/juju/juju/state/backups/testing"
)
type baseSuite struct {
jujutesting.JujuConnSuite
backupstesting.BaseSuite
client *backups.Client
}
func (s *baseSuite) SetUpTest(c *gc.C) {
s.BaseSuite.SetUpTest(c)
s.JujuConnSuite.SetUpTest(c)
client, err := backups.NewClient(s.APIState)
c.Assert(err, gc.IsNil)
s.client = client
}
func (s *baseSuite) checkMetadataResult(c *gc.C, result *params.BackupsMetadataResult, meta *stbackups.Metadata) {
var finished, stored time.Time
if meta.Finished != nil {
finished = *meta.Finished
}
if meta.Stored() != nil {
stored = *(meta.Stored())
}
c.Check(result.ID, gc.Equals, meta.ID())
c.Check(result.Started, gc.Equals, meta.Started)
c.Check(result.Finished, gc.Equals, finished)
c.Check(result.Checksum, gc.Equals, meta.Checksum())
c.Check(result.ChecksumFormat, gc.Equals, meta.ChecksumFormat())
c.Check(result.Size, gc.Equals, meta.Size())
c.Check(result.Stored, gc.Equals, stored)
c.Check(result.Notes, gc.Equals, meta.Notes)
c.Check(result.Model, gc.Equals, meta.Origin.Model)
c.Check(result.Machine, gc.Equals, meta.Origin.Machine)
c.Check(result.Hostname, gc.Equals, meta.Origin.Hostname)
c.Check(result.Version, gc.Equals, meta.Origin.Version)
}