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.
 
 
 

43 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. RJS_SOURCE = File(__file__).parent.child_folder('requirejs')
  11. TEST_SITE = File(__file__).parent.parent.child_folder('_test')
  12. class TestRequireJS(object):
  13. def setUp(self):
  14. TEST_SITE.make()
  15. TEST_SITE.parent.child_folder(
  16. 'sites/test_jinja').copy_contents_to(TEST_SITE)
  17. RJS_SOURCE.copy_contents_to(TEST_SITE.child('content/media/js'))
  18. File(TEST_SITE.child('content/media/js/app.js')).delete()
  19. def tearDown(self):
  20. TEST_SITE.delete()
  21. def test_can_execute_rjs(self):
  22. s = Site(TEST_SITE)
  23. s.config.plugins = ['hyde.ext.plugins.js.RequireJSPlugin']
  24. source = TEST_SITE.child('content/media/js/rjs.conf')
  25. target = File(
  26. Folder(s.config.deploy_root_path).child('media/js/app.js'))
  27. gen = Generator(s)
  28. gen.generate_resource_at_path(source)
  29. assert target.exists
  30. text = target.read_all()
  31. expected_text = File(RJS_SOURCE.child('app.js')).read_all()
  32. assert text == expected_text
  33. return