Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
6705c565
Commit
6705c565
authored
8 years ago
by
Chandrasekhar Ramakrishnan
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-4670: Run the tests against a real instance.
parent
eb367fc1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/python/pybis/tests/conftest.py
+5
-2
5 additions, 2 deletions
src/python/pybis/tests/conftest.py
src/python/pybis/tests/test_openbis.py
+7
-5
7 additions, 5 deletions
src/python/pybis/tests/test_openbis.py
with
12 additions
and
7 deletions
src/python/pybis/tests/conftest.py
+
5
−
2
View file @
6705c565
...
...
@@ -2,11 +2,14 @@ import pytest
from
pybis
import
Openbis
@pytest.yield_fixture
(
scope
=
"
module
"
)
def
openbis_instance
():
instance
=
Openbis
(
"
http://localhost:20000
"
)
# instance = Openbis("http://localhost:20000")
# Test against a real instance
instance
=
Openbis
(
"
https://localhost:8443
"
,
verify_certificates
=
False
)
print
(
"
\n
LOGGING IN...
"
)
instance
.
login
(
'
admin
'
,
'
anypassword
'
)
instance
.
login
(
'
admin
'
,
'
anypassword
'
)
yield
instance
instance
.
logout
()
print
(
"
LOGGED OUT...
"
)
This diff is collapsed.
Click to expand it.
src/python/pybis/tests/test_openbis.py
+
7
−
5
View file @
6705c565
...
...
@@ -4,16 +4,17 @@ import time
from
pybis
import
DataSet
from
pybis
import
Openbis
def
test_token
(
openbis_instance
):
assert
openbis_instance
.
hostname
is
not
None
new_instance
=
Openbis
(
openbis_instance
.
url
)
new_instance
=
Openbis
(
openbis_instance
.
url
,
verify_certificates
=
openbis_instance
.
verify_certificates
)
new_instance
.
login
(
'
admin
'
,
'
any_test_password
'
)
assert
new_instance
.
token
is
not
None
assert
new_instance
.
is_token_valid
()
is
True
new_instance
.
logout
()
assert
new_instance
.
is_token_valid
()
is
False
invalid_connection
=
Openbis
(
openbis_instance
.
url
)
invalid_connection
=
Openbis
(
openbis_instance
.
url
,
verify_certificates
=
openbis_instance
.
verify_certificates
)
with
pytest
.
raises
(
Exception
):
invalid_connection
.
login
(
'
invalid_username
'
,
'
invalid_password
'
)
assert
invalid_connection
.
token
is
None
...
...
@@ -28,16 +29,17 @@ def test_create_sample(openbis_instance):
s2
=
openbis_instance
.
get_sample
(
s
.
permid
)
assert
s2
is
not
None
def
test_cached_token
(
openbis_instance
):
openbis_instance
.
save_token
()
assert
openbis_instance
.
token_path
is
not
None
assert
openbis_instance
.
get_cached_token
()
is
not
None
assert
openbis_instance
.
_
get_cached_token
()
is
not
None
another_instance
=
Openbis
(
openbis_instance
.
url
)
another_instance
=
Openbis
(
openbis_instance
.
url
,
verify_certificates
=
openbis_instance
.
verify_certificates
)
assert
another_instance
.
is_token_valid
()
is
True
openbis_instance
.
delete_token
()
assert
openbis_instance
.
get_cached_token
()
is
None
assert
openbis_instance
.
_
get_cached_token
()
is
None
def
test_get_sample_by_id
(
openbis_instance
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment