Error Details
AssertionError: assert {'@id': 2068,...ab81a72', ...} == {'@id': 2068,...', ...}], ...}
Omitting 5 identical items, use -vv to show
Right contains 1 more item:
{'Experimenters': [{'@id': 0,
'@type': 'http://www.openmicroscopy.org/Schemas/OME/2016-06#Experimenter',
'FirstName': 'root',
'LastName': 'root',
'UserName': 'root',
'omero:details': {'@type': 'TBD#Details',
'permissions': {'@type': 'TBD#Permissions',
'canAnnotate': True,
'canDelete': False,
'canEdit': False,
'canLink': True,
'isGroupAnnotate': False,
'isGroupRead': False,
'isGroupWrite': False,
'isUserRead': False,
'isUserWrite': False,
'isWorldRead': False,
'isWorldWrite': False,
'perm': '------'}},
'omero:owner': True}]}
Full diff:
{
'@id': 2068,
'@type': 'http://www.openmicroscopy.org/Schemas/OME/2016-06#ExperimenterGroup',
'Description': '',
- 'Experimenters': [
- {
- '@id': 0,
- '@type': 'http://www.openmicroscopy.org/Schemas/OME/2016-06#Experimenter',
- 'FirstName': 'root',
- 'LastName': 'root',
- 'UserName': 'root',
- 'omero:details': {
- '@type': 'TBD#Details',
- 'permissions': {
- '@type': 'TBD#Permissions',
- 'canAnnotate': True,
- 'canDelete': False,
- 'canEdit': False,
- 'canLink': True,
- 'isGroupAnnotate': False,
- 'isGroupRead': False,
- 'isGroupWrite': False,
- 'isUserRead': False,
- 'isUserWrite': False,
- 'isWorldRead': False,
- 'isWorldWrite': False,
- 'perm': '------',
- },
- },
- 'omero:owner': True,
- },
- ],
'Name': '7ab81a72',
'omero:details': {
'@type': 'TBD#Details',
'permissions': {
'@type': 'TBD#Permissions',
'canAnnotate': True,
'canDelete': False,
'canEdit': False,
'canLink': True,
'isGroupAnnotate': False,
'isGroupRead': True,
'isGroupWrite': False,
'isUserRead': True,
'isUserWrite': True,
'isWorldRead': False,
'isWorldWrite': False,
'perm': 'rwr---',
},
},
}Stack Trace
self = <test_api_experimenters_groups.TestExperimenters object at 0x7f9b0e03f690>
user1 = (<omero.clients.BaseClient object at 0x7f9b0a5af7d0>, object #0 (::omero::model::Experimenter)
{
_id = object #1 (...nnotationLinksSeq =
{
}
_annotationLinksLoaded = False
_annotationLinksCountPerOwner =
{
}
})
def test_experimenters_groups(self, user1):
"""
Test listing experimenters.
We simply list existing Experimenters since we have no way to filter
and show only those created in the test.
"""
conn = get_connection(user1)
user_name = conn.getUser().getName()
django_client = self.new_django_client(user_name, user_name)
request_url = reverse(
'api_experimenters',
kwargs={'api_version': api_settings.API_VERSIONS[-1]})
data = {'limit': 10}
rsp = get_json(django_client, request_url, data)
exp_json = rsp['data']
query = """select obj from Experimenter as obj order by
lower(obj.lastName), lower(obj.firstName), obj.id"""
params = ParametersI()
params.page(0, 10)
exps = conn.getQueryService().findAllByQuery(query, params)
assert_objects(conn, exp_json, exps, dtype="Experimenter")
# Check we can follow link to Groups for first Experimenter
groups_url = exp_json[0]["url:experimentergroups"]
rsp = get_json(django_client, groups_url)
groups_json = rsp['data']
grp_ids = [g['@id'] for g in groups_json]
# Check if gids are same for experimenter (won't be ordered)
gids = [g.id for g in conn.getOtherGroups(exp_json[0]['@id'])]
assert set(gids) == set(grp_ids)
> assert_objects(conn, groups_json, grp_ids, dtype="ExperimenterGroup")
test/integration/test_api_experimenters_groups.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
conn = <omero.gateway._BlitzGateway object at 0x7f9b0ac836d0>
json_objects = [{'@id': 2068, '@type': 'http://www.openmicroscopy.org/Schemas/OME/2016-06#ExperimenterGroup', 'Description': '', 'Nam...s', 'permissions': {'@type': 'TBD#Permissions', 'canAnnotate': True, 'canDelete': False, 'canEdit': False, ...}}, ...}]
omero_ids_objects = [2068, 0, 2786, 1], dtype = 'ExperimenterGroup'
group = '-1', extra = None, opts = None, client = None
def assert_objects(conn, json_objects, omero_ids_objects, dtype="Project",
group='-1', extra=None, opts=None, client=None):
"""
Load objects from OMERO, via conn.getObjects().
marshal with omero_marshal and compare with json_objects.
omero_ids_objects can be IDs or list of omero.model objects.
@param: extra List of dicts containing expected extra json data
e.g. {'omero:childCount': 1}
"""
pids = []
for p in omero_ids_objects:
try:
pids.append(int(p))
except TypeError:
pids.append(p.id.val)
conn.SERVICE_OPTS.setOmeroGroup(group)
objs = conn.getObjects(dtype, pids, respect_order=True, opts=opts)
objs = [p._obj for p in objs]
expected = marshal_objects(objs)
assert len(json_objects) == len(expected)
for i, o1, o2 in zip(list(range(len(expected))), json_objects, expected):
if extra is not None and i < len(extra):
o2.update(extra[i])
# remove any urls from json, if not in both objects
o1 = copy.deepcopy(o1) # don't modify original
for key in list(o1.keys()):
if key.startswith('url:') and key not in o2:
del o1[key]
# add urls to any 'Image' in expected 'Wells' dict
add_image_urls(o2, client)
> assert o1 == o2
E AssertionError: assert {'@id': 2068,...ab81a72', ...} == {'@id': 2068,...', ...}], ...}
E
E Omitting 5 identical items, use -vv to show
E Right contains 1 more item:
E {'Experimenters': [{'@id': 0,
E '@type': 'http://www.openmicroscopy.org/Schemas/OME/2016-06#Experimenter',
E 'FirstName': 'root',
E 'LastName': 'root',
E 'UserName': 'root',
E 'omero:details': {'@type': 'TBD#Details',
E 'permissions': {'@type': 'TBD#Permissions',
E 'canAnnotate': True,
E 'canDelete': False,
E 'canEdit': False,
E 'canLink': True,
E 'isGroupAnnotate': False,
E 'isGroupRead': False,
E 'isGroupWrite': False,
E 'isUserRead': False,
E 'isUserWrite': False,
E 'isWorldRead': False,
E 'isWorldWrite': False,
E 'perm': '------'}},
E 'omero:owner': True}]}
E
E Full diff:
E {
E '@id': 2068,
E '@type': 'http://www.openmicroscopy.org/Schemas/OME/2016-06#ExperimenterGroup',
E 'Description': '',
E - 'Experimenters': [
E - {
E - '@id': 0,
E - '@type': 'http://www.openmicroscopy.org/Schemas/OME/2016-06#Experimenter',
E - 'FirstName': 'root',
E - 'LastName': 'root',
E - 'UserName': 'root',
E - 'omero:details': {
E - '@type': 'TBD#Details',
E - 'permissions': {
E - '@type': 'TBD#Permissions',
E - 'canAnnotate': True,
E - 'canDelete': False,
E - 'canEdit': False,
E - 'canLink': True,
E - 'isGroupAnnotate': False,
E - 'isGroupRead': False,
E - 'isGroupWrite': False,
E - 'isUserRead': False,
E - 'isUserWrite': False,
E - 'isWorldRead': False,
E - 'isWorldWrite': False,
E - 'perm': '------',
E - },
E - },
E - 'omero:owner': True,
E - },
E - ],
E 'Name': '7ab81a72',
E 'omero:details': {
E '@type': 'TBD#Details',
E 'permissions': {
E '@type': 'TBD#Permissions',
E 'canAnnotate': True,
E 'canDelete': False,
E 'canEdit': False,
E 'canLink': True,
E 'isGroupAnnotate': False,
E 'isGroupRead': True,
E 'isGroupWrite': False,
E 'isUserRead': True,
E 'isUserWrite': True,
E 'isWorldRead': False,
E 'isWorldWrite': False,
E 'perm': 'rwr---',
E },
E },
E }
test/integration/test_api_containers.py:99: AssertionError