0001 function pass = obi_test(varargin)
0002
0003
0004
0005
0006
0007 pass = true;
0008
0009 if nargin == 1
0010 teardown = varargin{1};
0011 else
0012 teardown = true;
0013 end
0014
0015
0016
0017
0018 obi = OpenBis();
0019 assert(obi.is_session_active(), 'Session not active');
0020
0021
0022 space_name = 'TESTING_SPACE';
0023 try
0024 space = obi.new_space(space_name, 'a space for tests of the Matlab openBIS Toolbox');
0025 catch
0026 disp('Could not create requested space')
0027 rethrow(lasterror)
0028 end
0029 spaces = obi.get_spaces();
0030 assert(any(ismember(spaces.code, space_name)), 'Space has not been created');
0031
0032
0033 project_name = 'TESTING_PROJECT';
0034 try
0035 project = obi.new_project(space, project_name, 'a project for tests of the Matlab openBIS Toolbox');
0036 catch
0037 disp('Could not create requested project')
0038 rethrow(lasterror)
0039 end
0040 projects = obi.get_projects(space_name, project_name);
0041 assert(any(ismember(projects.identifier, sprintf('/%s/%s', space_name, project_name))), 'Project has not been created');
0042
0043
0044 experiment_name = 'TESTING_EXPERIMENT';
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 if teardown
0055
0056 obi.delete_project(project_name, 'created by Matlab-openBIS toolbox test function')
0057
0058 obi.delete_space(space, 'created by Matlab-openBIS toolbox test function')
0059 end
0060
0061
0062 obi.logout()
0063
0064 end
0065