def test_file(self):
     request = self.get_request({'name':'/resultat/2011/1/125_1_test.pdf'})
     request.context = Mock(code_compta=CODE)
     result = file_display(request)
     self.assertEqual(result.content_disposition,
             "attachment; filename=125_1_test.pdf")
     self.assertEqual(result.content_type, "application/pdf")
Esempio n. 2
0
def test_file_view(get_csrf_request):
    request = get_csrf_request(
        post={'name': '/resultat/2011/1/125_1_test.pdf'})
    request.context = Mock(code_compta=CODE)
    result = file_display(request)
    assert (
        result.content_disposition == "attachment; filename=125_1_test.pdf")
    assert (result.content_type == "application/pdf")
def test_notfound(get_csrf_request):
    request = get_csrf_request(post={'name':'/resultat/2011/1/125_test2.pdf'})
    request.context = Mock(code_compta=CODE)
    result = file_display(request)
    assert(isinstance(result, HTTPNotFound))
def test_forbidden_notsubdir(get_csrf_request):
    request = get_csrf_request(post={'name':'../../test/125_test.pdf'})
    request.context = Mock(code_compta=CODE)
    result = file_display(request)
    assert(isinstance(result, HTTPForbidden))
def test_forbidden_wrond_code(get_csrf_request):
    request = get_csrf_request(post={'name':'/resultat/2011/1/125_test.pdf'})
    request.context = Mock(code_compta=CODE + "1")
    result = file_display(request)
    assert(isinstance(result, HTTPForbidden))
def test_file_view(get_csrf_request):
    request = get_csrf_request(post={'name':'/resultat/2011/1/125_1_test.pdf'})
    request.context = Mock(code_compta=CODE)
    result = file_display(request)
    assert(result.content_disposition == "attachment; filename=125_1_test.pdf")
    assert(result.content_type == "application/pdf")
 def test_notfound(self):
     request = self.get_request({'name':'/resultat/2011/1/125_test2.pdf'})
     request.context = Mock(code_compta=CODE)
     result = file_display(request)
     self.assertTrue(isinstance(result, HTTPNotFound))
 def test_forbidden_notsubdir(self):
     request = self.get_request({'name':'../../test/125_test.pdf'})
     request.context = Mock(code_compta=CODE)
     result = file_display(request)
     self.assertTrue(isinstance(result, HTTPForbidden))
 def test_forbidden_wrond_code(self):
     request = self.get_request({'name':'/resultat/2011/1/125_test.pdf'})
     request.context = Mock(code_compta=CODE + "1")
     result = file_display(request)
     self.assertTrue(isinstance(result, HTTPForbidden))
Esempio n. 10
0
def test_notfound(get_csrf_request):
    request = get_csrf_request(post={'name': '/resultat/2011/1/125_test2.pdf'})
    request.context = Mock(code_compta=CODE)
    result = file_display(request)
    assert (isinstance(result, HTTPNotFound))
Esempio n. 11
0
def test_forbidden_notsubdir(get_csrf_request):
    request = get_csrf_request(post={'name': '../../test/125_test.pdf'})
    request.context = Mock(code_compta=CODE)
    result = file_display(request)
    assert (isinstance(result, HTTPForbidden))
Esempio n. 12
0
def test_forbidden_wrond_code(get_csrf_request):
    request = get_csrf_request(post={'name': '/resultat/2011/1/125_test.pdf'})
    request.context = Mock(code_compta=CODE + "1")
    result = file_display(request)
    assert (isinstance(result, HTTPForbidden))