def test_get_public_file(self):
        """Tests for get_public_file."""
        file_dao = self.vgw.change_public_access(self.file.id, True)
        self.assertIsNotNone(file_dao.public_uuid)
        public_key = file_dao.public_key
        # Once a file has been made public, it can be looked up by its ID.
        file2 = self.gw.get_public_file(public_key)
        self.assertEqual(file2.id, self.file.id)
        self.assertEqual(file2.mimetype, 'fakemime')
        # this file was created with content, the content must be returned
        self.assertNotEquals(file2.content, None)

        # DoesNotExist is raised if that file is made private.
        file_dao = self.vgw.change_public_access(self.file.id, False)
        self.assertRaises(errors.DoesNotExist,
                          self.gw.get_public_file, public_key)

        # public stays the same when set back to public
        file_dao = self.vgw.change_public_access(file_dao.id, True)
        self.assertIsNotNone(file_dao.public_uuid)
        public_key = file_dao.public_key

        # DoesNotExist is raised if the underlying file is deleted.
        self.vgw.delete_node(self.file.id)
        self.assertRaises(
            errors.DoesNotExist, self.gw.get_public_file, public_key)