-
Notifications
You must be signed in to change notification settings - Fork 0
/
util_test.go
33 lines (28 loc) · 828 Bytes
/
util_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
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package resources_test
import (
"strings"
charmresource "github.com/juju/charm/v10/resource"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
)
func newFingerprint(c *gc.C, data string) charmresource.Fingerprint {
reader := strings.NewReader(data)
fp, err := charmresource.GenerateFingerprint(reader)
c.Assert(err, jc.ErrorIsNil)
return fp
}
func newFullCharmResource(c *gc.C, name string) charmresource.Resource {
return charmresource.Resource{
Meta: charmresource.Meta{
Name: name,
Type: charmresource.TypeFile,
Path: name + ".tgz",
Description: "you need it",
},
Origin: charmresource.OriginUpload,
Revision: 1,
Fingerprint: newFingerprint(c, name),
}
}