def test_get_public_files(self):
        """Test get_public_files method."""
        vgw = self.gw.get_root_gateway()
        root = StorageObject.objects.get_root(self.user._user)
        node = root.make_file('TheName', mimetype='fakemime')
        vgw.change_public_access(node.id, True)
        nodes = list(self.gw.get_public_files())
        self.assertEqual(1, len(nodes))
        self.assertEqual(node.id, nodes[0].id)
        self.assertEqual(node.volume_id, nodes[0].volume_id)
        self.assertIsNotNone(nodes[0].public_uuid)
        # now test it with more than one file (and some dirs too)

        def create_files(root):
            """Create a 5 dirs with 5 files each in the specified root."""
            for dname in ['dir_%s' % i for i in xrange(5)]:
                d = root.make_subdirectory(dname)
                for fname, j in [('file_%s' % j, j) for j in xrange(10)]:
                    f = d.make_file(fname, mimetype='fakemime')
                    if j % 2:
                        continue
                    vgw.change_public_access(f.id, True)
                    vgw.make_file(d.id, fname)

        create_files(root)
        file_cnt = 5 * 5 + 1
        nodes = list(self.gw.get_public_files())
        self.assertEqual(file_cnt, len(nodes))
        # and test it with public files inside a UDF
        udf = self.gw.make_udf('~/path/name')
        udf_root = StorageObject.objects.get(id=udf.root_id)
        create_files(udf_root)
        file_cnt = file_cnt + 5 * 5
        nodes = list(self.gw.get_public_files())
        self.assertEqual(file_cnt, len(nodes))