Skip to content

Commit

Permalink
Test get_omero_userdir
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Aug 11, 2020
1 parent a61dce5 commit c5c946f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/unit/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from omero.util.text import CSVStyle, JSONStyle, PlainStyle, TableBuilder
from omero.util.upgrade_check import UpgradeCheck
from omero.util.temp_files import manager
from omero.util import get_user_dir
from omero.util import get_omero_userdir, get_user_dir
from omero_version import omero_version
import omero.util.image_utils as image_utils
try:
Expand Down Expand Up @@ -314,3 +314,20 @@ def test_paste_image(self):
data_canvas[256, 256] = [255, 255, 0]
canvas = Image.fromarray(data_canvas, 'RGB')
image_utils.paste_image(img, canvas, 0, 0)


class TestUserdirs(object):

def testUserdirEnvironmentDefault(self, monkeypatch):
monkeypatch.delenv('OMERO_USERDIR', raising=False)
assert get_omero_userdir().basename() == 'omero'

def testUserdirEnvironmentAppdir(self, monkeypatch):
monkeypatch.setenv('OMERO_USERDIR', '')
d = get_omero_userdir()
assert d.basename() == omero_version.split('.')[0]
assert 'OMERO.cli' in str(d)

def testUserdirEnvironmentSet(self, monkeypatch, tmpdir):
monkeypatch.setenv('OMERO_USERDIR', str(tmpdir))
assert get_omero_userdir() == tmpdir

0 comments on commit c5c946f

Please sign in to comment.