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.
 
 
 

44 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. """
  3. Use nose
  4. `$ pip install nose`
  5. `$ nosetests`
  6. """
  7. from hyde.generator import Generator
  8. from hyde.site import Site
  9. from fswrap import File, Folder
  10. from util import assert_no_diff
  11. SCSS_SOURCE = File(__file__).parent.child_folder('scss')
  12. TEST_SITE = File(__file__).parent.parent.child_folder('_test')
  13. class TestSassyCSS(object):
  14. def setUp(self):
  15. TEST_SITE.make()
  16. TEST_SITE.parent.child_folder(
  17. 'sites/test_jinja').copy_contents_to(TEST_SITE)
  18. SCSS_SOURCE.copy_contents_to(TEST_SITE.child('content/media/css'))
  19. File(TEST_SITE.child('content/media/css/site.css')).delete()
  20. def tearDown(self):
  21. TEST_SITE.delete()
  22. def test_scss(self):
  23. s = Site(TEST_SITE)
  24. s.config.mode = 'prod'
  25. s.config.plugins = ['hyde.ext.plugins.css.SassyCSSPlugin']
  26. source = TEST_SITE.child('content/media/css/site.scss')
  27. target = File(
  28. Folder(s.config.deploy_root_path).child('media/css/site.css'))
  29. gen = Generator(s)
  30. gen.generate_resource_at_path(source)
  31. assert target.exists
  32. text = target.read_all()
  33. expected_text = File(SCSS_SOURCE.child('expected-site.css')).read_all()
  34. assert_no_diff(expected_text, text)