コード例 #1
0
ファイル: test_rename.py プロジェクト: sbesson/openmicroscopy
    def test_rename_permissions(self, data):
        owner, renamer, perms, allowed = data
        group = self.new_group(perms=perms)
        clients = {"user1": self.new_client(group=group), "user2": self.new_client(group=group), "root": self.root}
        orig_img = self.importMIF(name="rename", sizeX=16, sizeY=16, with_companion=True, client=clients[owner])[0]
        orig_fs = self.get_fileset([orig_img], clients[owner])

        uid = orig_fs.details.owner.id.val
        gid = orig_fs.details.group.id.val

        client = clients[renamer]
        mrepo = client.getManagedRepository()
        ctx = client.getContext(group=gid)
        if renamer == "root":
            ctx["omero.user"] = str(uid)

        new_dir = prep_directory(client, mrepo)
        try:
            tomove = self.assert_rename(orig_fs, new_dir, client=client, mrepo=mrepo, ctx=ctx)
            assert allowed
        except SecurityViolation:
            assert not allowed

        if renamer == "root":
            self.fake_move(tomove)
コード例 #2
0
ファイル: test_rename.py プロジェクト: sbesson/openmicroscopy
 def test_rename_annotation(self):
     ns = NSFSRENAME
     mrepo = self.client.getManagedRepository()
     orig_img = self.importMIF(with_companion=True)
     orig_fs = self.get_fileset(orig_img)
     new_dir = prep_directory(self.client, mrepo)
     self.assert_rename(orig_fs, new_dir)
     ann = self.query.projection(
         ("select a.id from FilesetAnnotationLink l " "join l.child as a where l.parent.id = :id " "and a.ns = :ns"),
         ParametersI().addId(orig_fs.id).addString("ns", ns),
     )
     assert ann
コード例 #3
0
 def test_rename_annotation(self):
     ns = NSFSRENAME
     mrepo = self.client.getManagedRepository()
     orig_img = self.import_fake_file(with_companion=True)
     orig_fs = self.get_fileset(orig_img)
     new_dir = prep_directory(self.client, mrepo)
     self.assert_rename(orig_fs, new_dir)
     ann = self.query.projection(
         ("select a.id from FilesetAnnotationLink l "
          "join l.child as a where l.parent.id = :id "
          "and a.ns = :ns"),
         ParametersI().addId(orig_fs.id).addString("ns", ns))
     assert ann
コード例 #4
0
    def test_rename_permissions(self, data):
        owner, renamer, perms, allowed = data
        group = self.new_group(perms=perms)
        clients = {
            "user1": self.new_client(group=group),
            "user2": self.new_client(group=group),
            "root": self.root,
        }
        orig_img = self.import_fake_file(name="rename",
                                         sizeX=16,
                                         sizeY=16,
                                         with_companion=True,
                                         client=clients[owner])[0]
        orig_fs = self.get_fileset([orig_img], clients[owner])

        uid = orig_fs.details.owner.id.val
        gid = orig_fs.details.group.id.val

        client = clients[renamer]
        mrepo = client.getManagedRepository()
        ctx = client.getContext(group=gid)
        if renamer == "root":
            ctx["omero.user"] = native_str(uid)

        new_dir = prep_directory(client, mrepo)
        try:
            tomove = self.assert_rename(orig_fs,
                                        new_dir,
                                        client=client,
                                        mrepo=mrepo,
                                        ctx=ctx)
            assert allowed
        except SecurityViolation:
            assert not allowed

        if renamer == "root":
            self.fake_move(tomove)
コード例 #5
0
 def test_prep_and_delete(self):
     mrepo = self.client.getManagedRepository()
     new_dir = prep_directory(self.client, mrepo)
     tree = list(contents(mrepo, new_dir))
     assert 0 == len(tree)
コード例 #6
0
ファイル: test_rename.py プロジェクト: sbesson/openmicroscopy
 def test_prep_and_delete(self):
     mrepo = self.client.getManagedRepository()
     new_dir = prep_directory(self.client, mrepo)
     tree = list(contents(mrepo, new_dir))
     assert 0 == len(tree)