58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using System;
|
|
using Xunit;
|
|
using Newtonsoft.Json.Linq;
|
|
using FluentAssertions;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Concurrent;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Headers;
|
|
using System.IO;
|
|
|
|
|
|
namespace raven_integration
|
|
{
|
|
|
|
public class ImportV7
|
|
{
|
|
//==================================================
|
|
/// <summary>
|
|
/// Test Importv7 stuff
|
|
/// </summary>
|
|
[Fact]
|
|
public async void ImportV7FileRoutesShouldWork()
|
|
{
|
|
|
|
string UploadFileName = "ayanova.data.dump.xxx.zip";
|
|
|
|
//////////////////////////////////////////
|
|
//// Upload the files
|
|
MultipartFormDataContent formDataContent = new MultipartFormDataContent();
|
|
|
|
StreamContent file1 = new StreamContent(File.OpenRead($"{Util.TEST_DATA_FOLDER}\\{UploadFileName}"));
|
|
file1.Headers.ContentType = new MediaTypeHeaderValue("application/zip");
|
|
file1.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data");
|
|
file1.Headers.ContentDisposition.FileName = UploadFileName;
|
|
formDataContent.Add(file1);
|
|
|
|
ApiResponse a = await Util.PostFormDataAsync("ImportAyaNova7", formDataContent, await Util.GetTokenAsync("OpsAdminFull"));
|
|
Util.ValidateDataReturnResponseOk(a);
|
|
|
|
string importFileName = a.ObjectResponse["result"][0].Value<string>();
|
|
importFileName.Should().Be(UploadFileName);
|
|
|
|
|
|
//////////////////////////////////////////
|
|
//// DELETE: Delete the file
|
|
ApiResponse d = await Util.DeleteAsync($"ImportAyaNova7/{UploadFileName}", await Util.GetTokenAsync("OpsAdminFull"));
|
|
Util.ValidateHTTPStatusCode(d, 204);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//==================================================
|
|
|
|
}//eoc
|
|
}//eons
|