public async Task WebApi_GetUserInfoUsingNodesEndpoint_ReturnsError() { var response = await UnauthorizedApi.GetNodeById(JohnId); response.IsSuccessStatusCode.ShouldBeEquivalentTo(false); response.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.Forbidden); }
public async Task FileSharing_WithUnauthorizeUser_ReturnsExpectedNotFoundFileNode() { var response = await UnauthorizedApi.GetNodeById(FileId); var sharedInfo = JsonConvert.DeserializeObject <JObject>(await response.Content.ReadAsStringAsync()); response.IsSuccessStatusCode.Should().Be(false); // response.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.NotFound); // response.ReasonPhrase.ShouldAllBeEquivalentTo("Not Found"); }
public async Task FileSharing_WithUnauthorizeUser_ReturnsExpectedNotFoundRecordNode() { var recordResponse = await JohnApi.GetNodesById(FileId); var recordNodes = JsonConvert.DeserializeObject <JArray>(await recordResponse.Content.ReadAsStringAsync()); var recordId = recordNodes.First()["id"].ToObject <Guid>(); recordId.Should().NotBeEmpty(); var response = await UnauthorizedApi.GetNodeById(recordId); response.IsSuccessStatusCode.Should().Be(false); // response.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.NotFound); // response.ReasonPhrase.ShouldAllBeEquivalentTo("Not Found"); }
public async Task FileSharing_WithUnauthorizeUser_ReturnsExpectedFileNode() { var blobInfo = await BlobStorage.GetFileInfo(BlobId, JohnId.ToString()); blobInfo.Should().NotBeNull(); var fileEntityResponse = await UnauthorizedApi.GetNodeById(FileId); fileEntityResponse.EnsureSuccessStatusCode(); fileEntityResponse.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK); var fileEntity = JsonConvert.DeserializeObject <JObject>(await fileEntityResponse.Content.ReadAsStringAsync()); fileEntity.Should().ContainsJson($@" {{ 'id': '{FileId}', 'blob': {{ 'id': '{blobInfo.Id}', 'bucket': '{JohnId}', 'length': {blobInfo.Length}, 'md5': '{blobInfo.MD5}' }}, 'subType': '{FileType.Records}', 'ownedBy': '{JohnId}', 'createdBy': '{JohnId}', 'createdDateTime': '{DateTime.UtcNow}', 'updatedBy': '{JohnId}', 'updatedDateTime': '{DateTime.UtcNow}', 'parentId': '{JohnId}', 'name': '{blobInfo.FileName}', 'status': '{FileStatus.Processed}', 'version': *EXIST*, 'totalRecords': 1, 'type': 'File' }}" ); fileEntity["images"].Should().HaveCount(1); }