view MoinMoin/util/_tests/ @ 2657:080673c3e60a

Now nameless items can also be downloaded and removed unnecessary blank spaces in items/
author Saurabh Kathpalia <>
date Sun, 06 Jul 2014 09:25:31 +0530
parents 181a556a0920
line wrap: on
line source
# -*- coding: utf-8 -*-
# Copyright: 2011 Prashant Kumar <contactprashantat AT gmail DOT com>
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

MoinMoin - MoinMoin.util.send_file Tests

import os
import tempfile
import shutil

import pytest

from MoinMoin.util import send_file

class TestFuid(object):
    """ test for send_file """

    def setup_method(self, method):
        self.test_dir = tempfile.mkdtemp('', 'test_dir')
        self.fname = os.path.join(self.test_dir, "test_file")

    def teardown_method(self, method):

    def makefile(self, fname, content):
        f = open(fname, "w")

    def test_temptest(self):
        self.makefile(self.fname, 'test_content')
        result = send_file.send_file(self.fname, as_attachment=True, conditional=True)
        expected = '<Response streamed [200 OK]>'
        assert str(result) == expected

        with pytest.raises(TypeError):
            send_file.send_file(None, as_attachment=True)