| 105 | } |
| 106 | |
| 107 | func (s *PublishedStorageSuite) TestPutFile(c *C) { |
| 108 | dir := c.MkDir() |
| 109 | err := os.WriteFile(filepath.Join(dir, "a"), []byte("welcome to gcs!"), 0644) |
| 110 | c.Assert(err, IsNil) |
| 111 | |
| 112 | err = s.storage.PutFile("a/b.txt", filepath.Join(dir, "a")) |
| 113 | c.Check(err, IsNil) |
| 114 | c.Check(s.GetFile(c, "a/b.txt"), DeepEquals, []byte("welcome to gcs!")) |
| 115 | |
| 116 | err = s.prefixedStorage.PutFile("a/b.txt", filepath.Join(dir, "a")) |
| 117 | c.Check(err, IsNil) |
| 118 | c.Check(s.GetFile(c, "lala/a/b.txt"), DeepEquals, []byte("welcome to gcs!")) |
| 119 | } |
| 120 | |
| 121 | func (s *PublishedStorageSuite) TestPutFileMissingSource(c *C) { |
| 122 | err := s.storage.PutFile("a/b.txt", filepath.Join(c.MkDir(), "does-not-exist")) |