github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/resource/context/internal/base_test.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package internal_test 5 6 import ( 7 "io" 8 "time" 9 10 "github.com/juju/testing" 11 gc "gopkg.in/check.v1" 12 13 "github.com/juju/juju/resource" 14 "github.com/juju/juju/resource/resourcetesting" 15 ) 16 17 func newResource(c *gc.C, stub *testing.Stub, name, content string) (resource.Resource, io.ReadCloser) { 18 opened := resourcetesting.NewResource(c, stub, name, "a-application", content) 19 res := opened.Resource 20 if content != "" { 21 return res, opened.ReadCloser 22 } 23 res.Username = "" 24 res.Timestamp = time.Time{} 25 return res, nil 26 }