From 052a9fb7c31a015111ca0534e0fc67e838a5325b Mon Sep 17 00:00:00 2001 From: vermeul <swen@ethz.ch> Date: Mon, 11 Dec 2017 13:49:28 +0100 Subject: [PATCH] moved space and sample tests to test_space.py and test_sample.py --- src/python/PyBis/tests/test_openbis.py | 69 -------------------------- 1 file changed, 69 deletions(-) diff --git a/src/python/PyBis/tests/test_openbis.py b/src/python/PyBis/tests/test_openbis.py index 21c09b70100..02f65ba1732 100644 --- a/src/python/PyBis/tests/test_openbis.py +++ b/src/python/PyBis/tests/test_openbis.py @@ -22,17 +22,6 @@ def test_wrong_login(openbis_instance): assert new_instance.token is None assert new_instance.is_session_active() is False -def test_create_delete_space(openbis_instance): - space_name = 'test_space_' + time.strftime('%a_%y%m%d_%H%M%S').upper() - 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() - with pytest.raises(ValueError): - space_not_exists = openbis_instance.get_space(code=space_name) - def test_cached_token(openbis_instance): openbis_instance.save_token() @@ -46,64 +35,6 @@ def test_cached_token(openbis_instance): assert openbis_instance._get_cached_token() is None -def test_create_sample(openbis_instance): - # given - sample_code = 'test_create_' + time.strftime('%a_%y%m%d_%H%M%S').upper() - sample_type = 'UNKNOWN' - space = 'DEFAULT' - # when - sample = openbis_instance.new_sample(code=sample_code, type=sample_type, space=space) - # then - assert sample is not None - assert sample.space == space - assert sample.code == sample_code - - -def test_get_sample_by_id(openbis_instance): - # given - sample_code = 'test_get_by_id_' + time.strftime('%a_%y%m%d_%H%M%S').upper() - sample = openbis_instance.new_sample(code=sample_code, type='UNKNOWN', space='DEFAULT') - sample.save() - # when - persisted_sample = openbis_instance.get_sample('/DEFAULT/' + sample_code) - # then - assert persisted_sample is not None - assert persisted_sample.permId is not None - -def test_get_sample_by_permid(openbis_instance): - # given - sample_code = 'test_get_by_permId_' + time.strftime('%a_%y%m%d_%H%M%S').upper() - sample = openbis_instance.new_sample(code=sample_code, type='UNKNOWN', space='DEFAULT') - sample.save() - persisted_sample = openbis_instance.get_sample('/DEFAULT/' + sample_code) - permId = persisted_sample.permId - # when - sample_by_permId = openbis_instance.get_sample(permId) - # then - assert sample_by_permId is not None - assert sample_by_permId.permId == permId - - -def test_get_sample_parents(openbis_instance): - id = '/TEST/TEST-SAMPLE-2' - sample = openbis_instance.get_sample(id) - assert sample is not None - assert sample.parents is not None - assert sample.parents[0]['identifier']['identifier'] == '/TEST/TEST-SAMPLE-2-PARENT' - parents = sample.get_parents() - assert isinstance(parents, list) - assert parents[0].ident == '/TEST/TEST-SAMPLE-2-PARENT' - - -def test_get_sample_children(openbis_instance): - id = '/TEST/TEST-SAMPLE-2' - sample = openbis_instance.get_sample(id) - assert sample is not None - assert sample.children is not None - assert sample.children[0]['identifier']['identifier'] == '/TEST/TEST-SAMPLE-2-CHILD-1' - children = sample.get_children() - assert isinstance(children, list) - assert children[0].ident == '/TEST/TEST-SAMPLE-2-CHILD-1' def test_get_dataset_parents(openbis_instance): -- GitLab