示例#1
0
 def test_deliver_existing_filename_with_prefix(self):
     from zopyx.smartprintng.server.views import deliver
     context = Server()
     file(os.path.join(context.spool_directory, 'foo.pdf'), 'wb').write('foo')
     request = testing.DummyRequest(params=dict(filename='foo.pdf', prefix='bar'))
     result = deliver(context, request)
     self.assertEqual(result.status, '200 OK')
     self.assertEqual(('content-disposition', 'attachment; filename=bar.pdf') in result.headerlist, True)
示例#2
0
 def test_deliver_non_existing_filename(self):
     from zopyx.smartprintng.server.views import deliver
     context = Server()
     request = testing.DummyRequest(params=dict(filename='does-not-exist.pdf'))
     result = deliver(context, request)
     self.assertEqual(result.status, '404 Not Found')