Пример #1
0
        public async Task MlProcessing_ModelTraining_AllGenericFilesProcessed()
        {
            var models = await Fixture.GetDependentFilesExcept(_testFixture.FolderId, FileType.Image, FileType.Tabular, FileType.Pdf);

            foreach (var modelId in models)
            {
                var model = await Session.Get <Model>(modelId);

                model.Should().NotBeNull();
                model.Status.Should().Be(ModelStatus.Processed);

                var responseSetPublic = JohnApi.SetPublicModelsEntity(modelId, true).GetAwaiter().GetResult();
                Harness.WaitWhileModelShared(modelId);
                responseSetPublic.EnsureSuccessStatusCode();
            }

            var response = await JohnApi.GetPublicNodes();

            var nodesContent = await response.Content.ReadAsStringAsync();

            var nodes = JToken.Parse(nodesContent);

            nodes.Should().HaveCount(1);


            await Task.CompletedTask;
        }
Пример #2
0
        public async Task FileSharing_CheckPageForNodesMe_ReturnsPaginationHeader()
        {
            const int currentPage = 1;
            const int pageSize    = 100;

            var response = await JohnApi.GetPublicNodes(currentPage, pageSize);

            response.EnsureSuccessStatusCode();

            var json       = JToken.Parse(await response.Content.ReadAsStringAsync());
            var totalCount = json.ContainsNodes(_testFixture.InternalIds);

            totalCount.ShouldBeEquivalentTo(2);

            var paginationHeader = response.Headers.GetValues("X-Pagination").Single();
            var jsonPagination   = JObject.Parse(paginationHeader);

            jsonPagination.Should().ContainsJson($@"
            {{
                'pageSize': {pageSize},
                'totalPages': 1,
                'currentPage': {currentPage}
            }}");
//                'totalCount': {json.Count()},
        }
Пример #3
0
        public async Task FileSharing_FindRootFolder_ReturnsOneFolderAndFourFiles()
        {
            var response = await JohnApi.GetPublicNodes();

            response.EnsureSuccessStatusCode();

            var nodes = JToken.Parse(await response.Content.ReadAsStringAsync());

            nodes.ContainsNodes(_testFixture.InternalIds).ShouldBeEquivalentTo(2);
        }
Пример #4
0
        public async Task FileSharing_GetPublicPageSize1_ReturnOneNodes()
        {
            var response = await JohnApi.GetPublicNodes(1, 1);

            response.EnsureSuccessStatusCode();

            var json = JToken.Parse(await response.Content.ReadAsStringAsync());

            json.ContainsNodes(_testFixture.InternalIds).ShouldBeEquivalentTo(1);
        }
Пример #5
0
        public async Task FileSharing_GetPublicChemicalStructures_ReturnTwoNodes()
        {
            var response = await JohnApi.GetPublicNodes(1, 2, "Name eq 'Aspirin.mol'");

            response.EnsureSuccessStatusCode();

            var json = JToken.Parse(await response.Content.ReadAsStringAsync());

            json.ContainsNodes(_testFixture.InternalIds).ShouldBeEquivalentTo(1);
        }
Пример #6
0
        public async Task FileSharing_SharedFolderAllowsToGetAccessToFile_ReturnsAllExpectedFile()
        {
            var fileName = "1100118.cif";
            var folderId = AddFolder("rootFolder", JohnId);

            await ChangeShareFolder(folderId, true);

            await AddFile(false, fileName, folderId);

            var response = await JohnApi.GetPublicNodes();

            response.EnsureSuccessStatusCode();
            var jsonFiles = JToken.Parse(await response.Content.ReadAsStringAsync());

            var responseFilesId = jsonFiles.Select(x => x["name"].ToObject <string>());

            responseFilesId.Contains(fileName).ShouldBeEquivalentTo(true);
        }
Пример #7
0
        public async Task FileSharing_NotSharedFolderAllowsToGetAccessToFileAndRecords_ReturnsEmpty()
        {
            var fileName = "test_solubility.sdf";
            var folderId = AddFolder("rootFolder", JohnId);

            await AddFile(false, fileName, folderId);

            var response = await JohnApi.GetPublicNodes();

            response.EnsureSuccessStatusCode();

            var jsonFiles = JToken.Parse(await response.Content.ReadAsStringAsync());

            jsonFiles.ContainsNodes(_testFixture.InternalIds).ShouldBeEquivalentTo(2);

            var responseFilesId = jsonFiles.Select(x => x["name"].ToObject <string>());

            responseFilesId.Contains(fileName).ShouldBeEquivalentTo(false);
        }
Пример #8
0
        public async Task FileSharing_GetPropertiesWithProjection_ReturnsNodesOnlyName()
        {
            var response = await JohnApi.GetPublicNodes(1, 2, null, "Name");

            response.EnsureSuccessStatusCode();

            var nodes = JToken.Parse(await response.Content.ReadAsStringAsync());

            nodes.ContainsNodes(_testFixture.InternalIds).ShouldBeEquivalentTo(2);

            var fileNames = new List <string>()
            {
                "Aspirin.mol", "0", "ringcount_0.mol", "0"
            };

            foreach (var node in nodes)
            {
                node.Should().HaveCount(2);
            }
        }