public void UploadFileToS3_GetS3SignedUrl_Delete_IntegrationTest() { // https://console.aws.amazon.com/s3/home?region=us-west-2# AppFileService target = (AppFileService)AppFileEN.GetService(""); string key = "systemtest/testintegrationfile2.jpg"; // test deleting existing file try { target.DeleteFromS3(key); } catch (Exception) { } byte[] testbytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; target.UploadFileToS3(key, testbytes, "image/jpg", Guid.NewGuid()); var url = target.GetS3SignedUrlAccess(key, 5); using (System.Net.WebClient w = new System.Net.WebClient()) { byte[] data = w.DownloadData(url); Assert.IsTrue(data.Length > 0); } target.DeleteFromS3(key); }
public void GetS3SignedUrlAccessTest() { // https://console.aws.amazon.com/s3/home?region=us-west-2# // test generates a url for downloading a file from S3 // it downloads the file and checks the length to be more than 0 AppFileService target = (AppFileService)AppFileEN.GetService(""); string key = "systemtest/testwebprivatedownload.jpg"; var url = target.GetS3SignedUrlAccess(key, 5); using (System.Net.WebClient w = new System.Net.WebClient()) { byte[] data = w.DownloadData(url); Assert.IsTrue(data.Length > 0); } }