     waitForExpectations()
   }
 
+  func testUnauthenticatedDeleteNonExistingFile() {
+    let expectation = self.expectation(description: #function)
+    let ref = storage.reference(withPath: "ios/public/fileThatDoesNotExist")
+    ref.delete { error in
+      XCTAssertNotNil(error, "Error should not be nil")
+      XCTAssertEqual((error! as NSError).code, StorageErrorCode.objectNotFound.rawValue)
+      expectation.fulfill()
+    }
+    waitForExpectations()
+  }
+
+  func testUnauthenticatedDeleteFileUnauthorized() {
+    let expectation = self.expectation(description: #function)
+    let ref = storage.reference(withPath: "ios/private/secretfile.txt")
+    ref.delete { error in
+      XCTAssertNotNil(error, "Error should not be nil")
+      XCTAssertEqual((error! as NSError).code, StorageErrorCode.unauthorized.rawValue)
+      expectation.fulfill()
+    }
+    waitForExpectations()
+  }
+
   func testDeleteWithNilCompletion() throws {
     let expectation = self.expectation(description: #function)
     let ref = storage.reference(withPath: "ios/public/fileToDelete")

        expectation.fulfill()
      } catch {
        XCTFail("Throw in downloadURL completion block")
      }
    })
    waitForExpectations()

    let fileURL = tmpDirURL.appendingPathComponent("hello.txt")
    try data.write(to: fileURL, options: .atomicWrite)
    ref.putFile(from: fileURL, metadata: nil, completion: { metadata, error in
      XCTAssertNotNil(metadata, "Metadata should not be nil")
      XCTAssertNil(error, "Error should be nil")
      expectation.fulfill()
    })
    waitForExpectations()
  }

  func testUnauthenticatedSimplePutBlankImage() throws {
    let expectation = self.expectation(description: #function)
    let fileName = "blank.jpg"
    let ref = storage.reference(withPath: "ios/public/" + fileName)
    let tmpDirURL = URL(fileURLWithPath: NSTemporaryDirectory())
    let imageURL = tmpDirURL.appendingPathComponent(fileName)

    let data = Data()
    try data.write(to: imageURL, options: .atomicWrite)

    ref.putFile(from: imageURL, metadata: nil, completion: { metadata, error in
      XCTAssertNotNil(metadata, "Metadata should not be nil")
      XCTAssertNil(error, "Error should be nil")
      expectation.fulfill()
