-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo_test.go
49 lines (40 loc) · 1.14 KB
/
info_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
// Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package backups_test
import (
"bytes"
"io/ioutil"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"github.com/juju/juju/apiserver/backups"
"github.com/juju/juju/apiserver/params"
)
func (s *backupsSuite) TestInfoOkay(c *gc.C) {
impl := s.setBackups(c, s.meta, "")
impl.Archive = ioutil.NopCloser(bytes.NewBufferString("spamspamspam"))
args := params.BackupsInfoArgs{
ID: "some-id",
}
result, err := s.api.Info(args)
c.Assert(err, jc.ErrorIsNil)
expected := backups.ResultFromMetadata(s.meta)
c.Check(result, gc.DeepEquals, expected)
}
func (s *backupsSuite) TestInfoMissingFile(c *gc.C) {
s.setBackups(c, s.meta, "")
args := params.BackupsInfoArgs{
ID: "some-id",
}
result, err := s.api.Info(args)
c.Assert(err, jc.ErrorIsNil)
expected := backups.ResultFromMetadata(s.meta)
c.Check(result, gc.DeepEquals, expected)
}
func (s *backupsSuite) TestInfoError(c *gc.C) {
s.setBackups(c, nil, "failed!")
args := params.BackupsInfoArgs{
ID: "some-id",
}
_, err := s.api.Info(args)
c.Check(err, gc.ErrorMatches, "failed!")
}