diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-new-api-test/html/openbis-new-api-test.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-new-api-test/html/openbis-new-api-test.js index e64a72a98b2c8c910dc653fc6fbab9f14efef185..315769e96825d7aafc0e6f46add705f94940d24a 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-new-api-test/html/openbis-new-api-test.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-new-api-test/html/openbis-new-api-test.js @@ -219,7 +219,7 @@ test("searchExperiments()", function() { test("createExperiments()", function() { createFacadeAndLogin(function(facade) { - var code = "NEW_JSON_EXPERIMENT_" + (new Date().getTime()); + var code = "CREATE_JSON_EXPERIMENT_" + (new Date().getTime()); facade.ajaxRequest({ url : testApiUrl, @@ -242,7 +242,7 @@ test("createExperiments()", function() { "tagIds" : [ { "@type" : "TagNameId", - "name" : "NEW_JSON_TAG" + "name" : "CREATE_JSON_TAG" } ] } ] ] @@ -262,7 +262,7 @@ test("createExperiments()", function() { equal(experiment.type.code, "UNKNOWN", "Type code"); equal(experiment.project.code, "TEST-PROJECT", "Project code"); equal(experiment.project.space.code, "TEST", "Space code"); - equal(experiment.tags[0].name, "NEW_JSON_TAG", "Tag code"); + equal(experiment.tags[0].name, "CREATE_JSON_TAG", "Tag code"); facade.close(); } }); @@ -270,3 +270,71 @@ test("createExperiments()", function() { }); }); }); + +test("updateExperiments()", function() { + createFacadeAndLogin(function(facade) { + var code = "UPDATE_JSON_EXPERIMENT_" + (new Date().getTime()); + + facade.ajaxRequest({ + url : testApiUrl, + data : { + "method" : "createExperiments", + "params" : [ facade.sessionToken, [ { + "@type" : "ExperimentCreation", + + "typeId" : { + "@type" : "EntityTypePermId", + "permId" : "UNKNOWN" + }, + + "code" : code, + + "projectId" : { + "@type" : "ProjectIdentifier", + "identifier" : "/TEST/TEST-PROJECT" + } + + } ] ] + }, + success : function(experimentPermIds) { + facade.ajaxRequest({ + url : testApiUrl, + data : { + "method" : "updateExperiments", + "params" : [ facade.sessionToken, [ { + "@type" : "ExperimentUpdate", + + "experimentId" : experimentPermIds[0], + + "projectId" : { + "@type" : "ProjectIdentifier", + "identifier" : "/PLATONIC/SCREENING-EXAMPLES" + } + + } ] ] + }, + success : function(experiments) { + + facade.ajaxRequest({ + url : testApiUrl, + data : { + "method" : "listExperiments", + "params" : [ facade.sessionToken, [ experimentPermIds[0] ], createExperimentFetchOptions() ] + }, + success : function(experiments) { + assertObjectsCount(experiments, 1); + + var experiment = experiments[0]; + equal(experiment.code, code, "Experiment code"); + equal(experiment.type.code, "UNKNOWN", "Type code"); + equal(experiment.project.code, "SCREENING-EXAMPLES", "Project code"); + equal(experiment.project.space.code, "PLATONIC", "Space code"); + facade.close(); + } + }); + } + }); + } + }); + }); +});