#!env/bin/python import os, sys sys.path.append( os.path.abspath( "." ) ) from botanjs.service.jwork import app, JWork from botanjs.config import Config as config SiteRoot = os.path.abspath( "." ) # Setting the SiteRoot for config config["Paths"]["SiteRoot"] = SiteRoot jsCache = config["Paths"]["Cache"] jsRoot = config["BotanJS"]["SrcDir"] bmap = os.path.join( jsCache, "botanjs", "bmap.xml" ) app.conf.update( broker_url = config["BotanJS"]["CeleryBroker"] ) JWork.buildClassMap.delay( jsRoot, bmap ) from botanjs.service.jclassresv import BotanClassResolver as JCResv srvHandler = JCResv( JWork, jsRoot, bmap, jsCache ) import unittest class TestStringMethods( unittest.TestCase ): # Run each twice to test the cache capabilities def test_ojscall( self ): for _ in range(0,2): s = srvHandler.getAPI( "System", mode = "rjs" ) self.assertTrue( "BotanJS.define( \"System\" );" in s ) def test_import( self ): for _ in range(0,2): s = srvHandler.getAPI( "System.Policy", mode = "rjs" ) self.assertTrue( "BotanJS.define( \"System.Policy\" );" in s ) self.assertTrue( "BotanJS.define( \"System.Global\" );" in s ) def test_cssInheritance( self ): for _ in range(0,2): s = srvHandler.getAPI( "System", mode = "rcss" ) self.assertTrue( "/* @ */" in s ) if __name__ == '__main__': unittest.main()