 
     let pushExpectation = expectation(description: "Sends a push notification to a User.")
 
-    var request = URLRequest(url: URL(string: "http://127.0.0.1:8090/push/images/2010")!)
+    let url = URL(string: "http://127.0.0.1:8090/push/images/2010")
+    XCTAssertNotNil(url, "Push notification URL for image 2010 is nil.")
+    var request = URLRequest(url: url!)
     request.httpMethod = "POST"
     request.addValue("application/json", forHTTPHeaderField: "Content-Type")
     request.addValue("Bearer \(self.accessToken)", forHTTPHeaderField: "Authorization")

    do {
      let imageData = try Data(contentsOf: imageURL)
      let jsonData = try JSONSerialization.data(withJSONObject: imageDictionary, options: JSONSerialization.WritingOptions(rawValue: 0))
      var request = URLRequest(url: URL(string: "http://127.0.0.1:8090/images")!, cachePolicy: .reloadIgnoringCacheData, timeoutInterval: 10.0)
      request.timeoutInterval = 60
      request.httpMethod = "POST"
      request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

  }

  func sendForTesting(fn: @escaping (Data) -> Void ) {
    let dataTask = URLSession(configuration: .default).dataTask(with: self) { data, response, error in
      XCTAssertNil(error)
      XCTAssertNotNil(data)
      switch (response as? HTTPURLResponse)?.statusCode {
        case nil: XCTFail("bad response")
        case 200?:
          XCTAssertNotNil(data, "Data from endpoint is nil.")
          fn(data!)
        case let sc?: XCTFail("bad status \(sc)")
      }
    }
