def test_get_all_with_mimetype(self):
        """Test get_all_nodes with mimetype filter."""
        hash = self.factory.get_fake_hash()
        key = uuid.uuid4()
        root_id = self.vgw.get_root().id

        def mkfile(i, m):
            return self.vgw.make_file_with_content(
                root_id, 'file%s' % i, hash, 1, 1, 1, key, mimetype=m)

        # make a bunch of files with content
        nodes = [mkfile(i, 'image/tif') for i in range(10)]
        # make a bunch of files with content and the wrong mimetype
        other_nodes = [mkfile(i, 'fake') for i in range(100, 110)]
        # an unknown mimetype will return nothing
        all_nodes = self.vgw.get_all_nodes(mimetypes=['mmm'])
        self.assertEqual(len(all_nodes), 0)
        # this will only return the ones with the matching mimetype
        all_nodes = self.vgw.get_all_nodes(mimetypes=['image/tif'])
        self.assertEqual(len(all_nodes), 10)
        # sort them in the right order
        nodes.sort(key=attrgetter('path', 'name'))
        self.assertEqual(all_nodes, nodes)
        # get both mimetypes
        nodes.extend(other_nodes)
        nodes.sort(key=attrgetter('path', 'name'))
        all_nodes = self.vgw.get_all_nodes(mimetypes=['image/tif', 'fake'])
        self.assertEqual(len(all_nodes), 20)
        self.assertEqual(all_nodes, nodes)