From 3ddb29d3c15307b180d3938ae68999456b982975 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 8 May 2020 23:56:19 +0000 Subject: [PATCH] --- Attachments/AttachmentTest.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Attachments/AttachmentTest.cs b/Attachments/AttachmentTest.cs index bded9ee..d514674 100644 --- a/Attachments/AttachmentTest.cs +++ b/Attachments/AttachmentTest.cs @@ -27,6 +27,11 @@ namespace raven_integration //Form data like the bizobject type and id formDataContent.Add(new StringContent("2"), name: "AttachToObjectType"); formDataContent.Add(new StringContent("1"), name: "AttachToObjectId"); + formDataContent.Add(new StringContent("Test:AttachmentUploadDownloadDeleteShouldWork"), name: "Notes"); + formDataContent.Add(new StringContent("[{\"name\":\"test.zip\",\"lastModified\":1582822079618},{\"name\":\"test.png\",\"lastModified\":1586900220990}]"), name: "FileData"); + + //fileData in JSON stringify format which contains the actual last modified dates etc + //"[{\"name\":\"Client.csv\",\"lastModified\":1582822079618},{\"name\":\"wmi4fu06nrs41.jpg\",\"lastModified\":1586900220990}]" //or if testing non-existant this is probably safe: long.MaxValue @@ -99,7 +104,7 @@ namespace raven_integration { MultipartFormDataContent formDataContent = new MultipartFormDataContent(); - + formDataContent.Add(new StringContent("2"), name: "AttachToObjectType"); formDataContent.Add(new StringContent("1"), name: "AttachToObjectId"); @@ -136,7 +141,7 @@ namespace raven_integration file1.Headers.ContentType = new MediaTypeHeaderValue("image/png"); file1.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data"); file1.Headers.ContentDisposition.FileName = "test.png"; - formDataContent.Add(file1); + formDataContent.Add(file1); ApiResponse a = await Util.PostFormDataAsync("Attachment", formDataContent, await Util.GetTokenAsync("InventoryFull")); //2203 unattachable object @@ -155,15 +160,15 @@ namespace raven_integration //Form data like the bizobject type and id formDataContent.Add(new StringContent("2"), name: "AttachToObjectType"); - + //HERE IS THE ERROR CONDITION, A NON EXISTENT ID VALUE FOR THE WIDGET formDataContent.Add(new StringContent(long.MaxValue.ToString()), name: "AttachToObjectId");//non-existent widget - + StreamContent file1 = new StreamContent(File.OpenRead($"{Util.TEST_DATA_FOLDER}\\test.png")); file1.Headers.ContentType = new MediaTypeHeaderValue("image/png"); file1.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data"); file1.Headers.ContentDisposition.FileName = "test.png"; - formDataContent.Add(file1); + formDataContent.Add(file1); ApiResponse a = await Util.PostFormDataAsync("Attachment", formDataContent, await Util.GetTokenAsync("InventoryFull")); //2203 invalid attachment object