public async Task FileSharing_WithAuthorizeUser_ReturnsRecordNotFound() { var blobResponse = await JohnApi.GetBlobRecordEntityById(FileId, BlobId); blobResponse.IsSuccessStatusCode.ShouldBeEquivalentTo(false); blobResponse.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.NotFound); blobResponse.ReasonPhrase.ShouldAllBeEquivalentTo("Not Found"); }
public async Task FileSharin_WithAuthorizeUser_ReturnsExpectedBlobRecord() { var nodeRecordResponse = await JohnApi.GetNodesById(FileId); var nodeRecord = JArray.Parse(await nodeRecordResponse.Content.ReadAsStringAsync()).First(); var nodeRecordId = nodeRecord["id"].ToObject <Guid>(); var recordResponse = await JohnApi.GetRecordEntityById(nodeRecordId); var record = JObject.Parse(await recordResponse.Content.ReadAsStringAsync()); var recordId = record["id"].ToObject <Guid>(); var recordBlobId = record["blob"]["id"].ToObject <Guid>(); var blobResponse = await JohnApi.GetBlobRecordEntityById(recordId, recordBlobId); blobResponse.EnsureSuccessStatusCode(); blobResponse.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK); blobResponse.Content.Headers.ContentType.MediaType.ShouldBeEquivalentTo("chemical/x-mdl-molfile"); blobResponse.Content.Headers.ContentLength.ShouldBeEquivalentTo(1689); //blobResponse.Content.Headers.ContentDisposition.FileName.Should().NotBeNullOrEmpty(); }
public async Task FileSharing_WithAuthorizeUser_ReturnsExpectedBlobFileAndRecord() { var nodeRecordResponse = await JohnApi.GetNodesById(FileId); var nodeRecord = JArray.Parse(await nodeRecordResponse.Content.ReadAsStringAsync()).First(); var nodeRecordId = nodeRecord["id"].ToObject <Guid>(); var recordResponse = await JohnApi.GetRecordEntityById(nodeRecordId); var record = JObject.Parse(await recordResponse.Content.ReadAsStringAsync()); var recordId = record["id"].ToObject <Guid>(); var recordBlobId = record["blob"]["id"].ToObject <Guid>(); var blobRecordResponse = await JohnApi.GetBlobRecordEntityById(recordId, recordBlobId); var recordString = await blobRecordResponse.Content.ReadAsStringAsync(); var blobFileResponse = await UnauthorizedApi.GetBlobFileEntityById(FileId, BlobId); var fileString = await blobFileResponse.Content.ReadAsStringAsync(); recordString.Should().BeEquivalentTo(fileString); }