view MoinMoin/util/_tests/ @ 1364:582e7109a8c1

mass update - delete trailing spaces and/or add blank line to end of file
author Roger Haase <>
date Wed, 06 Jun 2012 15:03:07 -0700
parents 4cd6611b0cf8
children 440b2150593d
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, shutil

from MoinMoin.util import send_file
import pytest

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)