Skip to content
Snippets Groups Projects
Commit 87e816d6 authored by Swen Vermeul's avatar Swen Vermeul
Browse files

Merge branch 'release/RELEASE'

parents 2b434437 a62a0f3d
No related branches found
No related tags found
No related merge requests found
import pytest
import time
from pybis import Openbis
openbis_url = 'https://localhost:8443'
admin_username = 'admin'
admin_password = '*****'
admin_password = 'tea4you2'
@pytest.yield_fixture(scope="module")
def openbis_instance():
......@@ -14,3 +15,19 @@ def openbis_instance():
yield instance
instance.logout()
print("LOGGED OUT...")
@pytest.yield_fixture(scope="module")
def space():
o = Openbis(url=openbis_url, verify_certificates=False)
o.login(admin_username, admin_password)
timestamp = time.strftime('%a_%y%m%d_%H%M%S').upper()
space_name = 'test_space_' + timestamp
space = o.new_space(code=space_name)
space.save()
space_exists = o.get_space(code=space_name)
yield space_exists
space.delete("testing on {}".format(timestamp))
o.logout()
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()
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
import json
import random
import re
import pytest
import time
from pybis import DataSet
from pybis import Openbis
def test_create_delete_space(openbis_instance):
timestamp = time.strftime('%a_%y%m%d_%H%M%S').upper()
space_name = 'test_space_' + timestamp
space = openbis_instance.new_space(code=space_name)
space.save()
space_exists = openbis_instance.get_space(code=space_name)
assert space_exists is not None
space.delete("test on {}".format(timestamp))
with pytest.raises(ValueError):
space_not_exists = openbis_instance.get_space(code=space_name)
assert space_not_exists is None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment