OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package filestorage_test | 4 package filestorage_test |
5 | 5 |
6 // The filestorage structs are used as stubs in tests. | 6 // The filestorage structs are used as stubs in tests. |
7 // The tests defined herein are simple smoke tests for the | 7 // The tests defined herein are simple smoke tests for the |
8 // required reader and writer functionality. | 8 // required reader and writer functionality. |
9 | 9 |
10 import ( | 10 import ( |
11 "bytes" | 11 "bytes" |
12 "io/ioutil" | 12 "io/ioutil" |
13 "os" | 13 "os" |
14 "path/filepath" | 14 "path/filepath" |
15 "strings" | 15 "strings" |
16 "testing" | 16 "testing" |
17 | 17 |
| 18 coreerrors "github.com/juju/errors" |
18 jc "github.com/juju/testing/checkers" | 19 jc "github.com/juju/testing/checkers" |
19 gc "launchpad.net/gocheck" | 20 gc "launchpad.net/gocheck" |
20 | 21 |
21 "launchpad.net/juju-core/environs/filestorage" | 22 "launchpad.net/juju-core/environs/filestorage" |
22 "launchpad.net/juju-core/environs/storage" | 23 "launchpad.net/juju-core/environs/storage" |
23 coreerrors "launchpad.net/juju-core/errors" | |
24 "launchpad.net/juju-core/juju/osenv" | 24 "launchpad.net/juju-core/juju/osenv" |
25 ) | 25 ) |
26 | 26 |
27 func TestPackage(t *testing.T) { | 27 func TestPackage(t *testing.T) { |
28 gc.TestingT(t) | 28 gc.TestingT(t) |
29 } | 29 } |
30 | 30 |
31 type filestorageSuite struct { | 31 type filestorageSuite struct { |
32 dir string | 32 dir string |
33 reader storage.StorageReader | 33 reader storage.StorageReader |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 c.Assert(err, gc.IsNil) | 230 c.Assert(err, gc.IsNil) |
231 err = os.Chdir(filepath.Join(dir, "a", "b", "c")) | 231 err = os.Chdir(filepath.Join(dir, "a", "b", "c")) |
232 c.Assert(err, gc.IsNil) | 232 c.Assert(err, gc.IsNil) |
233 defer os.Chdir(cwd) | 233 defer os.Chdir(cwd) |
234 reader, err := filestorage.NewFileStorageReader("../..") | 234 reader, err := filestorage.NewFileStorageReader("../..") |
235 c.Assert(err, gc.IsNil) | 235 c.Assert(err, gc.IsNil) |
236 url, err := reader.URL("") | 236 url, err := reader.URL("") |
237 c.Assert(err, gc.IsNil) | 237 c.Assert(err, gc.IsNil) |
238 c.Assert(url, gc.Equals, "file://"+dir+"/a") | 238 c.Assert(url, gc.Equals, "file://"+dir+"/a") |
239 } | 239 } |
OLD | NEW |