A fork of hyde, the static site generation.
Some patches will be pushed upstream.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- # -*- coding: utf-8 -*-
- """
- Use nose
- `$ pip install nose`
- `$ nosetests`
- """
- from hyde.model import Expando
- from hyde.generator import Generator
- from hyde.site import Site
-
- from fswrap import File, Folder
-
- OPTIPNG_SOURCE = File(__file__).parent.child_folder('optipng')
- TEST_SITE = File(__file__).parent.parent.child_folder('_test')
-
-
- class TestOptipng(object):
-
- def setUp(self):
- TEST_SITE.make()
- TEST_SITE.parent.child_folder(
- 'sites/test_jinja').copy_contents_to(TEST_SITE)
- IMAGES = TEST_SITE.child_folder('content/media/images')
- IMAGES.make()
- OPTIPNG_SOURCE.copy_contents_to(IMAGES)
-
- def tearDown(self):
- TEST_SITE.delete()
-
- def test_can_execute_optipng(self):
- s = Site(TEST_SITE)
- s.config.mode = "production"
- s.config.plugins = ['hyde.ext.plugins.images.OptiPNGPlugin']
- s.config.optipng = Expando(dict(args=dict(quiet="")))
- source = File(TEST_SITE.child('content/media/images/hyde-lt-b.png'))
- target = File(
- Folder(s.config.deploy_root_path).child(
- 'media/images/hyde-lt-b.png'))
- gen = Generator(s)
- gen.generate_resource_at_path(source)
- assert target.exists
- assert target.size < source.size
|