Merge pull request #60 from fkautz/pr_out_adding_more_api_suite_tests

This commit is contained in:
Frederick F. Kautz IV 2015-01-25 13:07:11 -08:00
commit aef9e60694

View File

@ -14,6 +14,7 @@ func APITestSuite(c *C, create func() Storage) {
testPaging(c, create) testPaging(c, create)
testObjectOverwriteFails(c, create) testObjectOverwriteFails(c, create)
testNonExistantBucketOperations(c, create) testNonExistantBucketOperations(c, create)
testBucketRecreateFails(c, create)
} }
func testCreateBucket(c *C, create func() Storage) { func testCreateBucket(c *C, create func() Storage) {
@ -74,8 +75,24 @@ func testPaging(c *C, create func() Storage) {
} }
func testObjectOverwriteFails(c *C, create func() Storage) { func testObjectOverwriteFails(c *C, create func() Storage) {
// test overwriting object fails storage := create()
storage.StoreBucket("bucket")
err := storage.StoreObject("bucket", "object", bytes.NewBufferString("one"))
c.Assert(err, IsNil)
err = storage.StoreObject("bucket", "object", bytes.NewBufferString("one"))
c.Assert(err, Not(IsNil))
} }
func testNonExistantBucketOperations(c *C, create func() Storage) { func testNonExistantBucketOperations(c *C, create func() Storage) {
// test writing object in non-existant bucket fails storage := create()
err := storage.StoreObject("bucket", "object", bytes.NewBufferString("one"))
c.Assert(err, Not(IsNil))
}
func testBucketRecreateFails(c *C, create func() Storage) {
storage := create()
err := storage.StoreBucket("string")
c.Assert(err, IsNil)
err = storage.StoreBucket("string")
c.Assert(err, Not(IsNil))
} }