This commit is contained in:
2020-05-08 23:56:19 +00:00
parent 400621d5d5
commit 3ddb29d3c1

View File

@@ -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