Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import json
import random
import re
import pytest
import time
from pybis import DataSet
from pybis import Openbis
def test_create_delete_project(space):
o=space.openbis
timestamp = time.strftime('%a_%y%m%d_%H%M%S').upper()
new_code='test_experiment_'+timestamp
with pytest.raises(TypeError):
# experiments must be assigned to a project
e_new = o.new_experiment(
code=new_code,
type='DEFAULT_EXPERIMENT',
)
e_new = o.new_experiment(
code=new_code,
project='DEFAULT',
type='DEFAULT_EXPERIMENT',
)
assert e_new.project is not None
e_new.save()
assert e_new.permId is not None
assert e_new.code == new_code
assert e_identifier == '/DEFAULT/DEFAULT/'+new_code
#project=o.new_project(space=space, code='illegal title contains spaces')
#with pytest.raises(ValueError):
# project.save()
# assert "should not have been created" is None
#project_name = 'project_'+timestamp
#project=o.new_project(space=space, code=project_name)
#project.save()
#project_exists=o.get_project(project_name)
#assert project_exists is not None
#project_exists.delete('test project on '+timestamp)
#
#with pytest.raises(ValueError):
# project_no_longer_exists=o.get_project(project_name)
# assert "project {} should have been deleted".format(project_name) is None